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/UpdateContainer.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/UpdateContainer.cxx')
-rw-r--r-- | src/UpdateContainer.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/UpdateContainer.cxx b/src/UpdateContainer.cxx index a24f38830..572f8cc67 100644 --- a/src/UpdateContainer.cxx +++ b/src/UpdateContainer.cxx @@ -28,7 +28,7 @@ #include "Mapper.hxx" #include "fs/Path.hxx" #include "tag/TagHandler.hxx" -#include "tag/Tag.hxx" +#include "tag/TagBuilder.hxx" #include <glib.h> @@ -86,6 +86,7 @@ update_container_file(Directory *directory, char *vtrack; unsigned int tnum = 0; + TagBuilder tag_builder; while ((vtrack = plugin->container_scan(pathname.c_str(), ++tnum)) != NULL) { Song *song = Song::NewFile(vtrack, contdir); @@ -95,9 +96,13 @@ update_container_file(Directory *directory, const Path child_path_fs = map_directory_child_fs(contdir, vtrack); - song->tag = new Tag(); decoder_plugin_scan_file(plugin, child_path_fs.c_str(), - &add_tag_handler, song->tag); + &add_tag_handler, &tag_builder); + + if (tag_builder.IsDefined()) + song->tag = tag_builder.Commit(); + else + tag_builder.Clear(); db_lock(); contdir->AddSong(song); |