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
ff58b8d2
Commit
ff58b8d2
authored
Oct 22, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag/Builder: move code to AddItemUnchecked()
parent
3f3f0af5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
TagBuilder.cxx
src/tag/TagBuilder.cxx
+12
-10
TagBuilder.hxx
src/tag/TagBuilder.hxx
+6
-0
No files found.
src/tag/TagBuilder.cxx
View file @
ff58b8d2
...
...
@@ -188,6 +188,16 @@ TagBuilder::Complement(const Tag &other)
tag_pool_lock
.
unlock
();
}
void
TagBuilder
::
AddItemUnchecked
(
TagType
type
,
StringView
value
)
noexcept
{
tag_pool_lock
.
lock
();
auto
i
=
tag_pool_get_item
(
type
,
value
);
tag_pool_lock
.
unlock
();
items
.
push_back
(
i
);
}
inline
void
TagBuilder
::
AddItemInternal
(
TagType
type
,
StringView
value
)
{
...
...
@@ -197,13 +207,9 @@ TagBuilder::AddItemInternal(TagType type, StringView value)
if
(
!
f
.
IsNull
())
value
=
{
f
.
data
,
f
.
size
};
tag_pool_lock
.
lock
();
auto
i
=
tag_pool_get_item
(
type
,
value
);
tag_pool_lock
.
unlock
();
AddItemUnchecked
(
type
,
value
);
free
(
f
.
data
);
items
.
push_back
(
i
);
}
void
...
...
@@ -229,11 +235,7 @@ TagBuilder::AddItem(TagType type, const char *value)
void
TagBuilder
::
AddEmptyItem
(
TagType
type
)
{
tag_pool_lock
.
lock
();
auto
i
=
tag_pool_get_item
(
type
,
StringView
::
Empty
());
tag_pool_lock
.
unlock
();
items
.
push_back
(
i
);
AddItemUnchecked
(
type
,
StringView
::
Empty
());
}
void
...
...
src/tag/TagBuilder.hxx
View file @
ff58b8d2
...
...
@@ -133,6 +133,12 @@ public:
void
Complement
(
const
Tag
&
other
);
/**
* A variant of AddItem() which does not attempt to fix up the
* value and does not check whether the tag type is disabled.
*/
void
AddItemUnchecked
(
TagType
type
,
StringView
value
)
noexcept
;
/**
* Appends a new tag item.
*
* @param type the type of the new tag item
...
...
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