diff options
author | Max Kellermann <max@musicpd.org> | 2017-02-07 18:31:30 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-02-08 09:04:41 +0100 |
commit | 17097d96b7452dbcd099af29239be9480aa9df8f (patch) | |
tree | c716d66ddf183059dd002cb907cc6579def227dd | |
parent | a3e28c2d1a1c85351ef5fe4e50ec75db6f4199c4 (diff) |
db/{Count,Print}: use tag_print(), eliminate duplicate code
-rw-r--r-- | src/TagPrint.cxx | 2 | ||||
-rw-r--r-- | src/db/Count.cxx | 3 | ||||
-rw-r--r-- | src/db/DatabasePrint.cxx | 6 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/TagPrint.cxx b/src/TagPrint.cxx index 41a25c894..1406f669b 100644 --- a/src/TagPrint.cxx +++ b/src/TagPrint.cxx @@ -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 diff --git a/src/db/Count.cxx b/src/db/Count.cxx index 9c3945677..e328e7379 100644 --- a/src/db/Count.cxx +++ b/src/db/Count.cxx @@ -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); } } diff --git a/src/db/DatabasePrint.cxx b/src/db/DatabasePrint.cxx index 87d441d20..a98553237 100644 --- a/src/db/DatabasePrint.cxx +++ b/src/db/DatabasePrint.cxx @@ -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 |