TagString: return WritableBuffer<char>

This commit is contained in:
Max Kellermann
2014-10-10 22:01:29 +02:00
parent 6520589a37
commit b7a1954c33
3 changed files with 26 additions and 24 deletions

View File

@@ -23,6 +23,7 @@
#include "TagPool.hxx"
#include "TagString.hxx"
#include "Tag.hxx"
#include "util/WritableBuffer.hxx"
#include <assert.h>
#include <string.h>
@@ -184,17 +185,17 @@ TagBuilder::AddItemInternal(TagType type, const char *value, size_t length)
assert(value != nullptr);
assert(length > 0);
char *p = FixTagString(value, length);
if (p != nullptr) {
value = p;
length = strlen(value);
auto f = FixTagString(value, length);
if (!f.IsNull()) {
value = f.data;
length = f.size;
}
tag_pool_lock.lock();
auto i = tag_pool_get_item(type, value, length);
tag_pool_lock.unlock();
free(p);
free(f.data);
items.push_back(i);
}