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; ++path;
} else { } else {
const char *slash = strchr(path, '/'); const char *slash = strchr(path, '/');
char *user = slash != nullptr const char *end = slash == nullptr
? g_strndup(path, slash - path) ? path + strlen(path)
: g_strdup(path); : slash;
const std::string user(path, end);
home = GetHome(user, error); home = GetHome(user.c_str(), error);
g_free(user);
if (slash == nullptr) if (slash == nullptr)
return home; return home;