From 7f9402bd22f02a46b32d53560094622493f33f37 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 31 Jul 2013 00:26:55 +0200 Subject: Tag: add method Clear() Allow reusing Tag instances. --- src/Tag.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/Tag.cxx') diff --git a/src/Tag.cxx b/src/Tag.cxx index b473c367e..7853f0a2f 100644 --- a/src/Tag.cxx +++ b/src/Tag.cxx @@ -132,6 +132,22 @@ void tag_lib_init(void) g_free(temp); } +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) { -- cgit v1.2.3