summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-09-08 07:31:25 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-09-09 13:49:30 -0400
commit116cc028742836e61abce7582ec9ecf9f0aaeb53 (patch)
tree243f1e22e5fdedc749ad4fab046527ef12ae86da /src
parenta6fde35332f5e7f78bff437d7b7bfded83debbaa (diff)
path-util.c: small modernization
Diffstat (limited to 'src')
-rw-r--r--src/shared/path-util.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index 0c1b6a0ab0..6888135778 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -102,7 +102,8 @@ char **path_split_and_make_absolute(const char *p) {
char **l;
assert(p);
- if (!(l = strv_split(p, ":")))
+ l = strv_split(p, ":");
+ if (!l)
return NULL;
if (!path_strv_make_absolute_cwd(l)) {
@@ -126,7 +127,7 @@ char *path_make_absolute(const char *p, const char *prefix) {
}
char *path_make_absolute_cwd(const char *p) {
- char *cwd, *r;
+ _cleanup_free_ char *cwd = NULL;
assert(p);
@@ -140,10 +141,7 @@ char *path_make_absolute_cwd(const char *p) {
if (!cwd)
return NULL;
- r = path_make_absolute(p, cwd);
- free(cwd);
-
- return r;
+ return path_make_absolute(p, cwd);
}
char **path_strv_make_absolute_cwd(char **l) {
@@ -156,7 +154,8 @@ char **path_strv_make_absolute_cwd(char **l) {
STRV_FOREACH(s, l) {
char *t;
- if (!(t = path_make_absolute_cwd(*s)))
+ t = path_make_absolute_cwd(*s);
+ if (!t)
return NULL;
free(*s);