diff options
author | Max Kellermann <max@duempel.org> | 2015-02-06 17:15:31 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-02-06 17:15:31 +0100 |
commit | ff2b427cc139adbf20e684db69dab9305c91c212 (patch) | |
tree | 8d95220da3458fc4fa741a5775bcb0bf98296127 /src/tag | |
parent | a62fe305464c6815dca7139dcb0cb689fcdfbaa1 (diff) | |
parent | 5761800197a86ba6de70af026546e678cbda4b91 (diff) | |
download | mpd-ff2b427cc139adbf20e684db69dab9305c91c212.tar.gz mpd-ff2b427cc139adbf20e684db69dab9305c91c212.tar.xz mpd-ff2b427cc139adbf20e684db69dab9305c91c212.zip |
Merge tag 'v0.19.9'
Diffstat (limited to 'src/tag')
-rw-r--r-- | src/tag/TagBuilder.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tag/TagBuilder.cxx b/src/tag/TagBuilder.cxx index 46024b44c..42e11e798 100644 --- a/src/tag/TagBuilder.cxx +++ b/src/tag/TagBuilder.cxx @@ -25,6 +25,8 @@ #include "Tag.hxx" #include "util/WritableBuffer.hxx" +#include <array> + #include <assert.h> #include <string.h> #include <stdlib.h> @@ -168,12 +170,19 @@ TagBuilder::Complement(const Tag &other) has_playlist |= other.has_playlist; + /* build a table of tag types that were already present in + this object, which will not be copied from #other */ + std::array<bool, TAG_NUM_OF_ITEM_TYPES> present; + present.fill(false); + for (const TagItem *i : items) + present[i->type] = true; + items.reserve(items.size() + other.num_items); tag_pool_lock.lock(); for (unsigned i = 0, n = other.num_items; i != n; ++i) { TagItem *item = other.items[i]; - if (!HasType(item->type)) + if (!present[item->type]) items.push_back(tag_pool_dup_item(item)); } tag_pool_lock.unlock(); |