aboutsummaryrefslogtreecommitdiffstats
path: root/src/DatabaseHelpers.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-18 19:08:39 +0100
committerMax Kellermann <max@duempel.org>2014-01-19 02:58:55 +0100
commitd2cf74027c2c252181ab16c1348281c252665353 (patch)
tree50dc8efe859419ad9f266bc277049bae34790c78 /src/DatabaseHelpers.cxx
parentbc966577ffb2354f44ebb85ceb83b188bb6907b6 (diff)
downloadmpd-d2cf74027c2c252181ab16c1348281c252665353.tar.gz
mpd-d2cf74027c2c252181ab16c1348281c252665353.tar.xz
mpd-d2cf74027c2c252181ab16c1348281c252665353.zip
Song: embed the Tag object statically into class Song
Reduces overhead because we need to manage only one memory allocation. According to valgrind/massif, we save 7%.
Diffstat (limited to 'src/DatabaseHelpers.cxx')
-rw-r--r--src/DatabaseHelpers.cxx7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/DatabaseHelpers.cxx b/src/DatabaseHelpers.cxx
index ee32630f4..e7bd006f0 100644
--- a/src/DatabaseHelpers.cxx
+++ b/src/DatabaseHelpers.cxx
@@ -39,9 +39,7 @@ typedef std::set<const char *, StringLess> StringSet;
static bool
CollectTags(StringSet &set, TagType tag_type, Song &song)
{
- Tag *tag = song.tag;
- if (tag == nullptr)
- return true;
+ const Tag *tag = &song.tag;
bool found = false;
for (unsigned i = 0; i < tag->num_items; ++i) {
@@ -108,8 +106,7 @@ StatsVisitSong(DatabaseStats &stats, StringSet &artists, StringSet &albums,
{
++stats.song_count;
- if (song.tag != nullptr)
- StatsVisitTag(stats, artists, albums, *song.tag);
+ StatsVisitTag(stats, artists, albums, song.tag);
return true;
}