diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-11-21 16:43:40 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-11-23 00:46:56 +0100 |
commit | 00e7b3c8e509a51517e7dd13cf24f9abba29f780 (patch) | |
tree | 0c6590bf01e331534c0df7981588a943384a5e08 /src/core | |
parent | 70-mouse.hwdb: Set DPI for MS Classic IntelliMouse (diff) | |
download | systemd-00e7b3c8e509a51517e7dd13cf24f9abba29f780.tar.xz systemd-00e7b3c8e509a51517e7dd13cf24f9abba29f780.zip |
unit: minor optimization, use stack over heap, when we can
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/unit.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/core/unit.c b/src/core/unit.c index 359bd62df9..f6c2e08b55 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -2985,7 +2985,6 @@ int unit_set_slice(Unit *u, Unit *slice) { } int unit_set_default_slice(Unit *u) { - _cleanup_free_ char *b = NULL; const char *slice_name; Unit *slice; int r; @@ -3013,13 +3012,9 @@ int unit_set_default_slice(Unit *u) { return -ENOMEM; if (MANAGER_IS_SYSTEM(u->manager)) - b = strjoin("system-", escaped, ".slice"); + slice_name = strjoina("system-", escaped, ".slice"); else - b = strappend(escaped, ".slice"); - if (!b) - return -ENOMEM; - - slice_name = b; + slice_name = strjoina(escaped, ".slice"); } else slice_name = MANAGER_IS_SYSTEM(u->manager) && !unit_has_name(u, SPECIAL_INIT_SCOPE) |