aboutsummaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/db')
-rw-r--r--src/db/Count.cxx4
-rw-r--r--src/db/DatabasePrint.cxx4
-rw-r--r--src/db/Helpers.cxx4
3 files changed, 3 insertions, 9 deletions
diff --git a/src/db/Count.cxx b/src/db/Count.cxx
index ec3eacd1f..4fd53a73b 100644
--- a/src/db/Count.cxx
+++ b/src/db/Count.cxx
@@ -73,9 +73,7 @@ static bool
CollectGroupCounts(TagCountMap &map, TagType group, const Tag &tag)
{
bool found = false;
- for (unsigned i = 0; i < tag.num_items; ++i) {
- const TagItem &item = *tag.items[i];
-
+ for (const auto &item : tag) {
if (item.type == group) {
auto r = map.insert(std::make_pair(item.value,
SearchStats()));
diff --git a/src/db/DatabasePrint.cxx b/src/db/DatabasePrint.cxx
index f6663311e..498aedf97 100644
--- a/src/db/DatabasePrint.cxx
+++ b/src/db/DatabasePrint.cxx
@@ -184,12 +184,10 @@ PrintUniqueTag(Client &client, TagType tag_type,
assert(value != nullptr);
client_printf(client, "%s: %s\n", tag_item_names[tag_type], value);
- for (unsigned i = 0, n = tag.num_items; i < n; i++) {
- const TagItem &item = *tag.items[i];
+ for (const auto &item : tag)
if (item.type != tag_type)
client_printf(client, "%s: %s\n",
tag_item_names[item.type], item.value);
- }
return true;
}
diff --git a/src/db/Helpers.cxx b/src/db/Helpers.cxx
index b849e73e8..089b2b17d 100644
--- a/src/db/Helpers.cxx
+++ b/src/db/Helpers.cxx
@@ -43,9 +43,7 @@ StatsVisitTag(DatabaseStats &stats, StringSet &artists, StringSet &albums,
if (tag.time > 0)
stats.total_duration += tag.time;
- for (unsigned i = 0; i < tag.num_items; ++i) {
- const TagItem &item = *tag.items[i];
-
+ for (const auto &item : tag) {
switch (item.type) {
case TAG_ARTIST:
#if defined(__clang__) || GCC_CHECK_VERSION(4,8)