aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-12-03 13:18:53 +0100
committerMax Kellermann <max@duempel.org>2013-12-03 13:19:45 +0100
commitd694150372408cd80b89a2e27a88f91b5f856b67 (patch)
tree71be7d1266a8245ace45ba2b5d460aacce0b1d2b /src
parent4ab586aaf11c8333ac6a245adfb660dca73fd5cd (diff)
downloadmpd-d694150372408cd80b89a2e27a88f91b5f856b67.tar.gz
mpd-d694150372408cd80b89a2e27a88f91b5f856b67.tar.xz
mpd-d694150372408cd80b89a2e27a88f91b5f856b67.zip
Tag: destructor calls Clear()
Eliminate duplicate code.
Diffstat (limited to 'src')
-rw-r--r--src/tag/Tag.cxx10
-rw-r--r--src/tag/Tag.hxx4
2 files changed, 3 insertions, 11 deletions
diff --git a/src/tag/Tag.cxx b/src/tag/Tag.cxx
index 7070d39c2..ac96f40b2 100644
--- a/src/tag/Tag.cxx
+++ b/src/tag/Tag.cxx
@@ -74,16 +74,6 @@ Tag::Clear()
num_items = 0;
}
-Tag::~Tag()
-{
- tag_pool_lock.lock();
- for (int i = num_items; --i >= 0; )
- tag_pool_put_item(items[i]);
- tag_pool_lock.unlock();
-
- delete[] items;
-}
-
Tag::Tag(const Tag &other)
:time(other.time), has_playlist(other.has_playlist),
items(nullptr),
diff --git a/src/tag/Tag.hxx b/src/tag/Tag.hxx
index 457a889bd..480115c5b 100644
--- a/src/tag/Tag.hxx
+++ b/src/tag/Tag.hxx
@@ -71,7 +71,9 @@ struct Tag {
/**
* Free the tag object and all its items.
*/
- ~Tag();
+ ~Tag() {
+ Clear();
+ }
Tag &operator=(const Tag &other) = delete;