chiark / gitweb /
core: unify how we generate the prefix string when dumping unit state
[elogind.git] / src / core / service.c
index 6a4665a1ae7ca560474e3661438498005bd519eb..887b1c8514cfd35ed6e13ede49faeb1b05ee6719 100644 (file)
@@ -463,16 +463,14 @@ static int service_load(Unit *u) {
 }
 
 static void service_dump(Unit *u, FILE *f, const char *prefix) {
-
         ServiceExecCommand c;
         Service *s = SERVICE(u);
         const char *prefix2;
-        _cleanup_free_ char *p2 = NULL;
 
         assert(s);
 
-        p2 = strappend(prefix, "\t");
-        prefix2 = p2 ? p2 : prefix;
+        prefix = strempty(prefix);
+        prefix2 = strappenda(prefix, "\t");
 
         fprintf(f,
                 "%sService State: %s\n"