From 923f18ef76a2a15d1451e97a9437b70bb38eefb3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 3 Dec 2013 11:31:03 +0100 Subject: IcyMetaDataParser: use class TagBuilder --- src/IcyMetaDataParser.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/IcyMetaDataParser.cxx') diff --git a/src/IcyMetaDataParser.cxx b/src/IcyMetaDataParser.cxx index 8861efb2e..6beeddd31 100644 --- a/src/IcyMetaDataParser.cxx +++ b/src/IcyMetaDataParser.cxx @@ -20,6 +20,7 @@ #include "config.h" #include "IcyMetaDataParser.hxx" #include "tag/Tag.hxx" +#include "tag/TagBuilder.hxx" #include "util/Domain.hxx" #include "Log.hxx" @@ -66,7 +67,7 @@ IcyMetaDataParser::Data(size_t length) } static void -icy_add_item(Tag &tag, TagType type, const char *value) +icy_add_item(TagBuilder &tag, TagType type, const char *value) { size_t length = strlen(value); @@ -81,7 +82,7 @@ icy_add_item(Tag &tag, TagType type, const char *value) } static void -icy_parse_tag_item(Tag &tag, const char *item) +icy_parse_tag_item(TagBuilder &tag, const char *item) { gchar **p = g_strsplit(item, "=", 0); @@ -99,15 +100,16 @@ icy_parse_tag_item(Tag &tag, const char *item) static Tag * icy_parse_tag(const char *p) { - Tag *tag = new Tag(); + TagBuilder tag; + gchar **items = g_strsplit(p, ";", 0); for (unsigned i = 0; items[i] != nullptr; ++i) - icy_parse_tag_item(*tag, items[i]); + icy_parse_tag_item(tag, items[i]); g_strfreev(items); - return tag; + return tag.Commit(); } size_t -- cgit v1.2.3