aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-09 22:22:56 +0200
committerMax Kellermann <max@duempel.org>2011-09-09 22:55:57 +0200
commitcceaec1d744b2059cc4ca25324da3c9a44d72191 (patch)
tree70172b353089c97475ccafcef9667eaa5923263a /src/utils.c
parent8e5f9c8160b5186c93c5d76789ffa88f3e5c2fde (diff)
utils: eliminate local variable "pos"
Just advance the "path" pointer.
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/utils.c b/src/utils.c
index 9481785d..5ed05324 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -48,7 +48,6 @@ char *parsePath(char *path)
g_warning("\"%s\" is not an absolute path", path);
return NULL;
} else if (path[0] == '~') {
- size_t pos = 1;
const char *home;
if (path[1] == '/' || path[1] == '\0') {
@@ -69,6 +68,8 @@ char *parsePath(char *path)
return NULL;
}
}
+
+ ++path;
} else {
bool foundSlash = false;
struct passwd *passwd;
@@ -79,7 +80,6 @@ char *parsePath(char *path)
foundSlash = true;
*c = '\0';
}
- pos = c - path;
passwd = getpwnam(path + 1);
if (!passwd) {
@@ -91,9 +91,10 @@ char *parsePath(char *path)
*c = '/';
home = passwd->pw_dir;
+ path = c;
}
- return g_strconcat(home, path + pos, NULL);
+ return g_strconcat(home, path, NULL);
} else {
#endif
return g_strdup(path);