summaryrefslogtreecommitdiff
path: root/src/unit-name.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-08-01 01:55:31 +0200
committerLennart Poettering <lennart@poettering.net>2011-08-01 01:55:31 +0200
commit70132bd0425ce0a65ed24197a2bcbf1cb2931352 (patch)
treededff73a402ae075c71499d23e16b323db539b9f /src/unit-name.c
parent911a4828e054a531be961cea34de89b666bda710 (diff)
util: various optimizations, using join()
Diffstat (limited to 'src/unit-name.c')
-rw-r--r--src/unit-name.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/unit-name.c b/src/unit-name.c
index 6d45576f85..1cbb804561 100644
--- a/src/unit-name.c
+++ b/src/unit-name.c
@@ -167,8 +167,6 @@ char *unit_name_change_suffix(const char *n, const char *suffix) {
}
char *unit_name_build(const char *prefix, const char *instance, const char *suffix) {
- char *r;
-
assert(prefix);
assert(unit_prefix_is_valid(prefix));
assert(!instance || unit_instance_is_valid(instance));
@@ -177,10 +175,7 @@ char *unit_name_build(const char *prefix, const char *instance, const char *suff
if (!instance)
return strappend(prefix, suffix);
- if (asprintf(&r, "%s@%s%s", prefix, instance, suffix) < 0)
- return NULL;
-
- return r;
+ return join(prefix, "@", instance, suffix, NULL);
}
static char* do_escape(const char *f, char *t) {