summaryrefslogtreecommitdiff
path: root/src/Tag.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-07-31 00:26:55 +0200
committerMax Kellermann <max@duempel.org>2013-07-31 00:35:05 +0200
commit7f9402bd22f02a46b32d53560094622493f33f37 (patch)
treeb96b437520be32a512943985035939b9b94e5223 /src/Tag.cxx
parentcbd38327e7f6948647768227ac4836f64e5ccd51 (diff)
Tag: add method Clear()
Allow reusing Tag instances.
Diffstat (limited to 'src/Tag.cxx')
-rw-r--r--src/Tag.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Tag.cxx b/src/Tag.cxx
index b473c367e..7853f0a2f 100644
--- a/src/Tag.cxx
+++ b/src/Tag.cxx
@@ -133,6 +133,22 @@ void tag_lib_init(void)
}
void
+Tag::Clear()
+{
+ time = -1;
+ has_playlist = false;
+
+ tag_pool_lock.lock();
+ for (unsigned i = 0; i < num_items; ++i)
+ tag_pool_put_item(items[i]);
+ tag_pool_lock.unlock();
+
+ g_free(items);
+ items = nullptr;
+ num_items = 0;
+}
+
+void
Tag::DeleteItem(unsigned idx)
{
assert(idx < num_items);