aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-23 21:59:52 +0100
committerMax Kellermann <max@duempel.org>2014-02-23 22:02:39 +0100
commit09e5f17b5de7372eb1624f628042f0892251637a (patch)
tree538544bc259e3d5e91dfb8fa86e1065bd227a945
parentdb20e29af6a3fc31f783c4584739ca1592beaabb (diff)
downloadmpd-09e5f17b5de7372eb1624f628042f0892251637a.tar.gz
mpd-09e5f17b5de7372eb1624f628042f0892251637a.tar.xz
mpd-09e5f17b5de7372eb1624f628042f0892251637a.zip
Directory: use PathTraitsUTF8::Build() instead of g_strconcat()
-rw-r--r--src/db/Directory.cxx17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/db/Directory.cxx b/src/db/Directory.cxx
index 04bdfa88f..01e147eff 100644
--- a/src/db/Directory.cxx
+++ b/src/db/Directory.cxx
@@ -86,20 +86,11 @@ Directory::CreateChild(const char *name_utf8)
assert(name_utf8 != nullptr);
assert(*name_utf8 != 0);
- char *allocated;
- const char *path_utf8;
- if (IsRoot()) {
- allocated = nullptr;
- path_utf8 = name_utf8;
- } else {
- allocated = g_strconcat(GetPath(),
- "/", name_utf8, nullptr);
- path_utf8 = allocated;
- }
-
- Directory *child = new Directory(path_utf8, this);
- g_free(allocated);
+ std::string path_utf8 = IsRoot()
+ ? std::string(name_utf8)
+ : PathTraitsUTF8::Build(GetPath(), name_utf8);
+ Directory *child = new Directory(std::move(path_utf8), this);
list_add_tail(&child->siblings, &children);
return child;
}