ConfigPath: use std::string

This commit is contained in:
Max Kellermann 2013-10-19 17:32:49 +02:00
parent 39e2ffe212
commit 7db124068f

View File

@ -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;