diff options
author | Max Kellermann <max@duempel.org> | 2013-09-05 19:11:50 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-09-26 17:35:08 +0200 |
commit | 52ee132d92d4a04d31bbbdeb7c6c0077bd2a2828 (patch) | |
tree | 098cf4f9385693b28e41c5342fcdfae416b058dd /src/tag/TagId3.cxx | |
parent | 7ca0aedcfc35c784d7ae07cd1f1e8dce684e5901 (diff) | |
download | mpd-52ee132d92d4a04d31bbbdeb7c6c0077bd2a2828.tar.gz mpd-52ee132d92d4a04d31bbbdeb7c6c0077bd2a2828.tar.xz mpd-52ee132d92d4a04d31bbbdeb7c6c0077bd2a2828.zip |
TagHandler: use a TagBuilder internally
Reduce heap allocator overhead.
Diffstat (limited to 'src/tag/TagId3.cxx')
-rw-r--r-- | src/tag/TagId3.cxx | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/tag/TagId3.cxx b/src/tag/TagId3.cxx index 0bea92bb7..0fc1b01db 100644 --- a/src/tag/TagId3.cxx +++ b/src/tag/TagId3.cxx @@ -22,6 +22,7 @@ #include "TagHandler.hxx" #include "TagTable.hxx" #include "Tag.hxx" +#include "TagBuilder.hxx" #include "util/Error.hxx" #include "ConfigGlobal.hxx" @@ -387,16 +388,11 @@ scan_id3_tag(struct id3_tag *tag, Tag * tag_id3_import(struct id3_tag *tag) { - Tag *ret = new Tag(); - - scan_id3_tag(tag, &add_tag_handler, ret); - - if (ret->IsEmpty()) { - delete ret; - ret = nullptr; - } - - return ret; + TagBuilder tag_builder; + scan_id3_tag(tag, &add_tag_handler, &tag_builder); + return tag_builder.IsEmpty() + ? nullptr + : tag_builder.Commit(); } static int |