summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-09-13 22:42:22 +0200
committerLennart Poettering <lennart@poettering.net>2012-09-13 22:42:22 +0200
commita33fdebb30cac102db7037a5bcdc85d6c49d4aad (patch)
tree7e5d4d8f54f48b71a8ff9fab40f5e4ce0a3fdfd8
parent37370d0cbe7c79d3f5b44a9ddbfac87c59dc09dd (diff)
systemctl: minor coding style fixes
-rw-r--r--src/systemctl/systemctl.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index dd835aa37a..efb9ae2946 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -3552,23 +3552,25 @@ finish:
}
static int mangle_names(char **original_names, char ***mangled_names) {
- char **names_it = NULL;
- char **name = NULL;
+ char **i, **l, **name;
- (*mangled_names) = new(char*, strv_length(original_names)+1);
- if(!(*mangled_names))
+ l = new(char*, strv_length(original_names) + 1);
+ if (!l)
return log_oom();
- names_it = *mangled_names;
-
+ i = l;
STRV_FOREACH(name, original_names) {
- char *n = unit_name_mangle(*name);
- (*names_it) = n ? n : strdup(*name);
- if(!(*names_it))
+ *i = unit_name_mangle(*name);
+ if (!*i) {
+ strv_free(l);
return log_oom();
- names_it++;
+ }
+
+ i++;
}
- *names_it = NULL;
+
+ *i = NULL;
+ *mangled_names = l;
return 0;
}