aboutsummaryrefslogtreecommitdiffstats
path: root/src/ConfigPath.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-19 17:32:49 +0200
committerMax Kellermann <max@duempel.org>2013-10-19 17:32:49 +0200
commit7db124068f60f8f8208c9f5601407202381e2ecb (patch)
tree6a55aa1e305291b60c6cbca16fdff4cf51b8b72f /src/ConfigPath.cxx
parent39e2ffe212acdbb240867606f31b16c5f8f3fdfc (diff)
downloadmpd-7db124068f60f8f8208c9f5601407202381e2ecb.tar.gz
mpd-7db124068f60f8f8208c9f5601407202381e2ecb.tar.xz
mpd-7db124068f60f8f8208c9f5601407202381e2ecb.zip
ConfigPath: use std::string
Diffstat (limited to 'src/ConfigPath.cxx')
-rw-r--r--src/ConfigPath.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/ConfigPath.cxx b/src/ConfigPath.cxx
index 2f3f3ad23..b88de3934 100644
--- a/src/ConfigPath.cxx
+++ b/src/ConfigPath.cxx
@@ -99,12 +99,11 @@ ParsePath(const char *path, Error &error)
++path;
} else {
const char *slash = strchr(path, '/');
- char *user = slash != nullptr
- ? g_strndup(path, slash - path)
- : g_strdup(path);
-
- home = GetHome(user, error);
- g_free(user);
+ const char *end = slash == nullptr
+ ? path + strlen(path)
+ : slash;
+ const std::string user(path, end);
+ home = GetHome(user.c_str(), error);
if (slash == nullptr)
return home;