Commit 986dd2fa authored by Max Kellermann's avatar Max Kellermann

db/Helpers: move code to CheckUniqueTag()

parent 3965b490
......@@ -39,20 +39,26 @@ struct StringLess {
typedef std::set<const char *, StringLess> StringSet;
static bool
CollectTags(StringSet &set, TagType tag_type, const LightSong &song)
CheckUniqueTag(StringSet &set, const Tag &tag, TagType type)
{
assert(song.tag != nullptr);
const Tag &tag = *song.tag;
bool found = false;
for (unsigned i = 0; i < tag.num_items; ++i) {
if (tag.items[i]->type == tag_type) {
if (tag.items[i]->type == type) {
set.insert(tag.items[i]->value);
found = true;
}
}
if (!found)
return found;
}
static bool
CollectTags(StringSet &set, TagType tag_type, const LightSong &song)
{
assert(song.tag != nullptr);
const Tag &tag = *song.tag;
if (!CheckUniqueTag(set, tag, tag_type))
set.insert("");
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment