aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-15 22:01:46 +0200
committerMax Kellermann <max@duempel.org>2013-10-15 22:49:12 +0200
commit67f87db511a7284fbadf65bbf984480d1eaaeabc (patch)
treec842daf94b93c27eb4ded425ef49e1e604513c37
parent7de96275dd6e3b6997e799413e4537561041e199 (diff)
downloadmpd-67f87db511a7284fbadf65bbf984480d1eaaeabc.tar.gz
mpd-67f87db511a7284fbadf65bbf984480d1eaaeabc.tar.xz
mpd-67f87db511a7284fbadf65bbf984480d1eaaeabc.zip
UpdateArchive: use std::string for temporary string
-rw-r--r--src/UpdateArchive.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/UpdateArchive.cxx b/src/UpdateArchive.cxx
index b920b8303..6ec73c47a 100644
--- a/src/UpdateArchive.cxx
+++ b/src/UpdateArchive.cxx
@@ -33,7 +33,7 @@
#include "util/Error.hxx"
#include "Log.hxx"
-#include <glib.h>
+#include <string>
#include <string.h>
@@ -42,14 +42,13 @@ update_archive_tree(Directory *directory, const char *name)
{
const char *tmp = strchr(name, '/');
if (tmp) {
- char *child_name = g_strndup(name, tmp - name);
+ const std::string child_name(name, tmp);
//add dir is not there already
db_lock();
Directory *subdir =
- directory->MakeChild(child_name);
+ directory->MakeChild(child_name.c_str());
subdir->device = DEVICE_INARCHIVE;
db_unlock();
- g_free(child_name);
//create directories first
update_archive_tree(subdir, tmp+1);