diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-08-01 02:39:22 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-08-01 02:39:22 +0200 |
commit | 44d91056924e1e64699892f71121b40c46489e57 (patch) | |
tree | 1ef1841e1e3a92f75519e7a3e3635ad078dc15a0 /src/util.c | |
parent | 70132bd0425ce0a65ed24197a2bcbf1cb2931352 (diff) |
util: use join() instead of asprintf() as an optimization
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/util.c b/src/util.c index b533b26daf..6382c01c55 100644 --- a/src/util.c +++ b/src/util.c @@ -809,7 +809,7 @@ int parse_env_file( const char *separator, ...) { int r = 0; - char *contents, *p; + char *contents = NULL, *p; assert(fname); assert(separator); @@ -1266,8 +1266,6 @@ bool is_path(const char *p) { } char *path_make_absolute(const char *p, const char *prefix) { - char *r; - assert(p); /* Makes every item in the list an absolute path by prepending @@ -1276,10 +1274,7 @@ char *path_make_absolute(const char *p, const char *prefix) { if (path_is_absolute(p) || !prefix) return strdup(p); - if (asprintf(&r, "%s/%s", prefix, p) < 0) - return NULL; - - return r; + return join(prefix, "/", p, NULL); } char *path_make_absolute_cwd(const char *p) { |