tag/Builder: move code to AddItemUnchecked()
This commit is contained in:
parent
3f3f0af543
commit
ff58b8d255
@ -188,6 +188,16 @@ TagBuilder::Complement(const Tag &other)
|
|||||||
tag_pool_lock.unlock();
|
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
|
inline void
|
||||||
TagBuilder::AddItemInternal(TagType type, StringView value)
|
TagBuilder::AddItemInternal(TagType type, StringView value)
|
||||||
{
|
{
|
||||||
@ -197,13 +207,9 @@ TagBuilder::AddItemInternal(TagType type, StringView value)
|
|||||||
if (!f.IsNull())
|
if (!f.IsNull())
|
||||||
value = { f.data, f.size };
|
value = { f.data, f.size };
|
||||||
|
|
||||||
tag_pool_lock.lock();
|
AddItemUnchecked(type, value);
|
||||||
auto i = tag_pool_get_item(type, value);
|
|
||||||
tag_pool_lock.unlock();
|
|
||||||
|
|
||||||
free(f.data);
|
free(f.data);
|
||||||
|
|
||||||
items.push_back(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -229,11 +235,7 @@ TagBuilder::AddItem(TagType type, const char *value)
|
|||||||
void
|
void
|
||||||
TagBuilder::AddEmptyItem(TagType type)
|
TagBuilder::AddEmptyItem(TagType type)
|
||||||
{
|
{
|
||||||
tag_pool_lock.lock();
|
AddItemUnchecked(type, StringView::Empty());
|
||||||
auto i = tag_pool_get_item(type, StringView::Empty());
|
|
||||||
tag_pool_lock.unlock();
|
|
||||||
|
|
||||||
items.push_back(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -132,6 +132,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
void Complement(const Tag &other);
|
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.
|
* Appends a new tag item.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user