aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-02-06 17:15:31 +0100
committerMax Kellermann <max@duempel.org>2015-02-06 17:15:31 +0100
commitff2b427cc139adbf20e684db69dab9305c91c212 (patch)
tree8d95220da3458fc4fa741a5775bcb0bf98296127 /src/tag
parenta62fe305464c6815dca7139dcb0cb689fcdfbaa1 (diff)
parent5761800197a86ba6de70af026546e678cbda4b91 (diff)
downloadmpd-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.cxx11
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();