summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2016-04-14 10:14:41 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2016-04-14 10:14:41 +0200
commit8fae819099a189f03213ee657f44545c1b035f7e (patch)
treea398d2aea2046ae90f149288f9df9befc8d7e4fb /src/shared
parent43bbb8f005177bcad135ec894419361f0f420034 (diff)
parent78df0edc1b594017b1d3493eb2033d8a92d9d43f (diff)
Merge pull request #3033 from keszybz/code-cleanups
Code cleanups
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/bus-util.c4
-rw-r--r--src/shared/path-lookup.c26
2 files changed, 12 insertions, 18 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 0caaca03c7..2b86b1fcd6 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -2050,8 +2050,8 @@ static void log_job_error_with_service_result(const char* service, const char *r
_cleanup_free_ char *t;
t = strv_join((char**) extra_args, " ");
- systemctl = strjoina("systemctl ", t ?: "<args>", NULL);
- journalctl = strjoina("journalctl ", t ?: "<args>", NULL);
+ systemctl = strjoina("systemctl ", t ? : "<args>");
+ journalctl = strjoina("journalctl ", t ? : "<args>");
}
if (!isempty(result)) {
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index ca69a0aef2..80a2ea7940 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -249,7 +249,7 @@ static int acquire_generator_dirs(
if (!e)
return -ENXIO;
- prefix = strjoina(e, "/systemd/", NULL);
+ prefix = strjoina(e, "/systemd/");
break;
}
@@ -451,7 +451,7 @@ int lookup_paths_init(
*transient = NULL,
*persistent_control = NULL, *runtime_control = NULL;
bool append = false; /* Add items from SYSTEMD_UNIT_PATH before normal directories */
- char **l = NULL;
+ _cleanup_strv_free_ char **paths = NULL;
const char *e;
int r;
@@ -506,13 +506,12 @@ int lookup_paths_init(
/* FIXME: empty components in other places should be
* rejected. */
- r = path_split_and_make_absolute(e, &l);
+ r = path_split_and_make_absolute(e, &paths);
if (r < 0)
return r;
- } else
- l = NULL;
+ }
- if (!l || append) {
+ if (!paths || append) {
/* Let's figure something out. */
_cleanup_strv_free_ char **add = NULL;
@@ -587,14 +586,9 @@ int lookup_paths_init(
if (!add)
return -ENOMEM;
- if (l) {
- r = strv_extend_strv(&l, add, false);
- if (r < 0)
+ r = strv_extend_strv(&paths, add, true);
+ if (r < 0)
return r;
- } else {
- l = add;
- add = NULL;
- }
}
r = patch_root_prefix(&persistent_config, root);
@@ -626,12 +620,12 @@ int lookup_paths_init(
if (r < 0)
return r;
- r = patch_root_prefix_strv(l, root);
+ r = patch_root_prefix_strv(paths, root);
if (r < 0)
return -ENOMEM;
- p->search_path = strv_uniq(l);
- l = NULL;
+ p->search_path = strv_uniq(paths);
+ paths = NULL;
p->persistent_config = persistent_config;
p->runtime_config = runtime_config;