Commit 17097d96 authored by Max Kellermann's avatar Max Kellermann

db/{Count,Print}: use tag_print(), eliminate duplicate code

parent a3e28c2d
......@@ -41,7 +41,7 @@ void
tag_print_values(Response &r, const Tag &tag)
{
for (const auto &i : tag)
r.Format("%s: %s\n", tag_item_names[i.type], i.value);
tag_print(r, i.type, i.value);
}
void
......
......@@ -25,6 +25,7 @@
#include "client/Response.hxx"
#include "LightSong.hxx"
#include "tag/Tag.hxx"
#include "TagPrint.hxx"
#include <functional>
#include <map>
......@@ -57,7 +58,7 @@ Print(Response &r, TagType group, const TagCountMap &m)
assert(unsigned(group) < TAG_NUM_OF_ITEM_TYPES);
for (const auto &i : m) {
r.Format("%s: %s\n", tag_item_names[group], i.first.c_str());
tag_print(r, group, i.first.c_str());
PrintSearchStats(r, i.second);
}
}
......
......@@ -23,6 +23,7 @@
#include "SongFilter.hxx"
#include "SongPrint.hxx"
#include "TimePrint.hxx"
#include "TagPrint.hxx"
#include "client/Response.hxx"
#include "Partition.hxx"
#include "tag/Tag.hxx"
......@@ -192,12 +193,11 @@ PrintUniqueTag(Response &r, TagType tag_type,
{
const char *value = tag.GetValue(tag_type);
assert(value != nullptr);
r.Format("%s: %s\n", tag_item_names[tag_type], value);
tag_print(r, tag_type, value);
for (const auto &item : tag)
if (item.type != tag_type)
r.Format("%s: %s\n",
tag_item_names[item.type], item.value);
tag_print(r, item.type, item.value);
}
void
......
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