Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
1ea04cd8
Commit
1ea04cd8
authored
Jan 20, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag/Pool: add "noexcept"
parent
b334643b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
Pool.cxx
src/tag/Pool.cxx
+11
-11
Pool.hxx
src/tag/Pool.hxx
+3
-3
No files found.
src/tag/Pool.cxx
View file @
1ea04cd8
...
...
@@ -43,7 +43,7 @@ struct TagPoolSlot {
static
constexpr
unsigned
MAX_REF
=
std
::
numeric_limits
<
decltype
(
ref
)
>::
max
();
TagPoolSlot
(
TagPoolSlot
*
_next
,
TagType
type
,
StringView
value
)
StringView
value
)
noexcept
:
next
(
_next
)
{
item
.
type
=
type
;
memcpy
(
item
.
value
,
value
.
data
,
value
.
size
);
...
...
@@ -51,12 +51,12 @@ struct TagPoolSlot {
}
static
TagPoolSlot
*
Create
(
TagPoolSlot
*
_next
,
TagType
type
,
StringView
value
);
StringView
value
)
noexcept
;
};
TagPoolSlot
*
TagPoolSlot
::
Create
(
TagPoolSlot
*
_next
,
TagType
type
,
StringView
value
)
StringView
value
)
noexcept
{
TagPoolSlot
*
dummy
;
return
NewVarSize
<
TagPoolSlot
>
(
sizeof
(
dummy
->
item
.
value
),
...
...
@@ -68,7 +68,7 @@ TagPoolSlot::Create(TagPoolSlot *_next, TagType type,
static
TagPoolSlot
*
slots
[
NUM_SLOTS
];
static
inline
unsigned
calc_hash
(
TagType
type
,
StringView
p
)
calc_hash
(
TagType
type
,
StringView
p
)
noexcept
{
unsigned
hash
=
5381
;
...
...
@@ -79,7 +79,7 @@ calc_hash(TagType type, StringView p)
}
static
inline
unsigned
calc_hash
(
TagType
type
,
const
char
*
p
)
calc_hash
(
TagType
type
,
const
char
*
p
)
noexcept
{
unsigned
hash
=
5381
;
...
...
@@ -92,25 +92,25 @@ calc_hash(TagType type, const char *p)
}
static
inline
constexpr
TagPoolSlot
*
tag_item_to_slot
(
TagItem
*
item
)
tag_item_to_slot
(
TagItem
*
item
)
noexcept
{
return
&
ContainerCast
(
*
item
,
&
TagPoolSlot
::
item
);
}
static
inline
TagPoolSlot
**
tag_value_slot_p
(
TagType
type
,
StringView
value
)
tag_value_slot_p
(
TagType
type
,
StringView
value
)
noexcept
{
return
&
slots
[
calc_hash
(
type
,
value
)
%
NUM_SLOTS
];
}
static
inline
TagPoolSlot
**
tag_value_slot_p
(
TagType
type
,
const
char
*
value
)
tag_value_slot_p
(
TagType
type
,
const
char
*
value
)
noexcept
{
return
&
slots
[
calc_hash
(
type
,
value
)
%
NUM_SLOTS
];
}
TagItem
*
tag_pool_get_item
(
TagType
type
,
StringView
value
)
tag_pool_get_item
(
TagType
type
,
StringView
value
)
noexcept
{
auto
slot_p
=
tag_value_slot_p
(
type
,
value
);
for
(
auto
slot
=
*
slot_p
;
slot
!=
nullptr
;
slot
=
slot
->
next
)
{
...
...
@@ -129,7 +129,7 @@ tag_pool_get_item(TagType type, StringView value)
}
TagItem
*
tag_pool_dup_item
(
TagItem
*
item
)
tag_pool_dup_item
(
TagItem
*
item
)
noexcept
{
TagPoolSlot
*
slot
=
tag_item_to_slot
(
item
);
...
...
@@ -147,7 +147,7 @@ tag_pool_dup_item(TagItem *item)
}
void
tag_pool_put_item
(
TagItem
*
item
)
tag_pool_put_item
(
TagItem
*
item
)
noexcept
{
TagPoolSlot
**
slot_p
,
*
slot
;
...
...
src/tag/Pool.hxx
View file @
1ea04cd8
...
...
@@ -29,12 +29,12 @@ struct TagItem;
struct
StringView
;
TagItem
*
tag_pool_get_item
(
TagType
type
,
StringView
value
);
tag_pool_get_item
(
TagType
type
,
StringView
value
)
noexcept
;
TagItem
*
tag_pool_dup_item
(
TagItem
*
item
);
tag_pool_dup_item
(
TagItem
*
item
)
noexcept
;
void
tag_pool_put_item
(
TagItem
*
item
);
tag_pool_put_item
(
TagItem
*
item
)
noexcept
;
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment