summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-23 11:43:27 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-23 11:43:27 -0400
commit605405c6cc934466951b0c6bad5a9553620bcb08 (patch)
treeaf4eb757a0508374d581f746e3ce6a3ca5606dbb /src/shared
parent3c5d7c978c5f5e6fcc1d3175bb22dd1b3477f4b4 (diff)
tree-wide: drop NULL sentinel from strjoin
This makes strjoin and strjoina more similar and avoids the useless final argument. spatch -I . -I ./src -I ./src/basic -I ./src/basic -I ./src/shared -I ./src/shared -I ./src/network -I ./src/locale -I ./src/login -I ./src/journal -I ./src/journal -I ./src/timedate -I ./src/timesync -I ./src/nspawn -I ./src/resolve -I ./src/resolve -I ./src/systemd -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -I ./src/udev/net -I ./src/udev -I ./src/libsystemd/sd-bus -I ./src/libsystemd/sd-event -I ./src/libsystemd/sd-login -I ./src/libsystemd/sd-netlink -I ./src/libsystemd/sd-network -I ./src/libsystemd/sd-hwdb -I ./src/libsystemd/sd-device -I ./src/libsystemd/sd-id128 -I ./src/libsystemd-network --sp-file coccinelle/strjoin.cocci --in-place $(git ls-files src/*.c) git grep -e '\bstrjoin\b.*NULL' -l|xargs sed -i -r 's/strjoin\((.*), NULL\)/strjoin(\1)/' This might have missed a few cases (spatch has a really hard time dealing with _cleanup_ macros), but that's no big issue, they can always be fixed later.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/base-filesystem.c2
-rw-r--r--src/shared/bus-util.c4
-rw-r--r--src/shared/cgroup-show.c2
-rw-r--r--src/shared/conf-parser.c2
-rw-r--r--src/shared/dns-domain.c4
-rw-r--r--src/shared/dropin.c10
-rw-r--r--src/shared/fstab-util.c2
-rw-r--r--src/shared/install-printf.c2
-rw-r--r--src/shared/install.c10
-rw-r--r--src/shared/machine-image.c2
-rw-r--r--src/shared/path-lookup.c4
11 files changed, 22 insertions, 22 deletions
diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
index 59a34a9d11..f1fbce9dca 100644
--- a/src/shared/base-filesystem.c
+++ b/src/shared/base-filesystem.c
@@ -82,7 +82,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
if (table[i].exists) {
_cleanup_free_ char *p = NULL;
- p = strjoin(s, "/", table[i].exists, NULL);
+ p = strjoin(s, "/", table[i].exists);
if (!p)
return log_oom();
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index bb90c89cc2..3b8768b9a7 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -676,7 +676,7 @@ int bus_connect_user_systemd(sd_bus **_bus) {
if (r < 0)
return r;
- bus->address = strjoin("unix:path=", ee, "/systemd/private", NULL);
+ bus->address = strjoin("unix:path=", ee, "/systemd/private");
if (!bus->address)
return -ENOMEM;
@@ -1460,7 +1460,7 @@ int bus_path_encode_unique(sd_bus *b, const char *prefix, const char *sender_id,
if (!external_label)
return -ENOMEM;
- p = strjoin(prefix, "/", sender_label, "/", external_label, NULL);
+ p = strjoin(prefix, "/", sender_label, "/", external_label);
if (!p)
return -ENOMEM;
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
index 3e451db715..4db6cefb6e 100644
--- a/src/shared/cgroup-show.c
+++ b/src/shared/cgroup-show.c
@@ -158,7 +158,7 @@ int show_cgroup_by_path(
while ((r = cg_read_subgroup(d, &gn)) > 0) {
_cleanup_free_ char *k = NULL;
- k = strjoin(fn, "/", gn, NULL);
+ k = strjoin(fn, "/", gn);
free(gn);
if (!k)
return -ENOMEM;
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 2ec0155b71..19a371c865 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -101,7 +101,7 @@ int config_item_perf_lookup(
else {
char *key;
- key = strjoin(section, ".", lvalue, NULL);
+ key = strjoin(section, ".", lvalue);
if (!key)
return -ENOMEM;
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
index 892f0aadf5..f9a6fd5f03 100644
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
@@ -1076,7 +1076,7 @@ int dns_service_split(const char *joined, char **_name, char **_type, char **_do
if (!name)
return -ENOMEM;
- type = strjoin(b, ".", c, NULL);
+ type = strjoin(b, ".", c);
if (!type)
return -ENOMEM;
@@ -1090,7 +1090,7 @@ int dns_service_split(const char *joined, char **_name, char **_type, char **_do
name = NULL;
- type = strjoin(a, ".", b, NULL);
+ type = strjoin(a, ".", b);
if (!type)
return -ENOMEM;
diff --git a/src/shared/dropin.c b/src/shared/dropin.c
index b9cd952ac8..2c1cd84df5 100644
--- a/src/shared/dropin.c
+++ b/src/shared/dropin.c
@@ -61,11 +61,11 @@ int drop_in_file(const char *dir, const char *unit, unsigned level,
if (!filename_is_valid(b))
return -EINVAL;
- p = strjoin(dir, "/", unit, ".d", NULL);
+ p = strjoin(dir, "/", unit, ".d");
if (!p)
return -ENOMEM;
- q = strjoin(p, "/", prefix, "-", b, ".conf", NULL);
+ q = strjoin(p, "/", prefix, "-", b, ".conf");
if (!q) {
free(p);
return -ENOMEM;
@@ -163,7 +163,7 @@ static int iterate_dir(
if (hidden_or_backup_file(de->d_name))
continue;
- f = strjoin(path, "/", de->d_name, NULL);
+ f = strjoin(path, "/", de->d_name);
if (!f)
return log_oom();
@@ -192,7 +192,7 @@ int unit_file_process_dir(
assert(name);
assert(suffix);
- path = strjoin(unit_path, "/", name, suffix, NULL);
+ path = strjoin(unit_path, "/", name, suffix);
if (!path)
return log_oom();
@@ -207,7 +207,7 @@ int unit_file_process_dir(
if (r < 0)
return log_error_errno(r, "Failed to generate template from unit name: %m");
- p = strjoin(unit_path, "/", template, suffix, NULL);
+ p = strjoin(unit_path, "/", template, suffix);
if (!p)
return log_oom();
diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c
index a4e0cd3267..f0bfb30bb5 100644
--- a/src/shared/fstab-util.c
+++ b/src/shared/fstab-util.c
@@ -241,7 +241,7 @@ static char *tag_to_udev_node(const char *tagvalue, const char *by) {
if (encode_devnode_name(u, t, enc_len) < 0)
return NULL;
- return strjoin("/dev/disk/by-", by, "/", t, NULL);
+ return strjoin("/dev/disk/by-", by, "/", t);
}
char *fstab_node_to_udev_node(const char *p) {
diff --git a/src/shared/install-printf.c b/src/shared/install-printf.c
index cbdf66827f..007c632f35 100644
--- a/src/shared/install-printf.c
+++ b/src/shared/install-printf.c
@@ -45,7 +45,7 @@ static int specifier_prefix_and_instance(char specifier, void *data, void *userd
if (endswith(prefix, "@") && i->default_instance) {
char *ans;
- ans = strjoin(prefix, i->default_instance, NULL);
+ ans = strjoin(prefix, i->default_instance);
if (!ans)
return -ENOMEM;
*ret = ans;
diff --git a/src/shared/install.c b/src/shared/install.c
index d33a658d0a..21cb57bc5a 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1303,7 +1303,7 @@ static int unit_file_search(
STRV_FOREACH(p, paths->search_path) {
_cleanup_free_ char *path = NULL;
- path = strjoin(*p, "/", info->name, NULL);
+ path = strjoin(*p, "/", info->name);
if (!path)
return -ENOMEM;
@@ -1328,7 +1328,7 @@ static int unit_file_search(
STRV_FOREACH(p, paths->search_path) {
_cleanup_free_ char *path = NULL;
- path = strjoin(*p, "/", template, NULL);
+ path = strjoin(*p, "/", template);
if (!path)
return -ENOMEM;
@@ -1608,7 +1608,7 @@ static int install_info_symlink_wants(
continue;
}
- path = strjoin(config_path, "/", dst, suffix, n, NULL);
+ path = strjoin(config_path, "/", dst, suffix, n);
if (!path)
return -ENOMEM;
@@ -1642,7 +1642,7 @@ static int install_info_symlink_link(
if (r > 0)
return 0;
- path = strjoin(config_path, "/", i->name, NULL);
+ path = strjoin(config_path, "/", i->name);
if (!path)
return -ENOMEM;
@@ -2162,7 +2162,7 @@ int unit_file_revert(
STRV_FOREACH(j, fs) {
_cleanup_free_ char *t = NULL;
- t = strjoin(*i, "/", *j, NULL);
+ t = strjoin(*i, "/", *j);
if (!t)
return -ENOMEM;
diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
index 060f8d50c7..6414ba5246 100644
--- a/src/shared/machine-image.c
+++ b/src/shared/machine-image.c
@@ -131,7 +131,7 @@ static int image_new(
return -ENOMEM;
if (path)
- i->path = strjoin(path, "/", filename, NULL);
+ i->path = strjoin(path, "/", filename);
else
i->path = strdup(filename);
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index 862096ae7b..a23d09967e 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -70,7 +70,7 @@ static int user_config_dir(char **ret, const char *suffix) {
if (!home)
return -ENXIO;
- j = strjoin(home, "/.config", suffix, NULL);
+ j = strjoin(home, "/.config", suffix);
}
if (!j)
@@ -102,7 +102,7 @@ static int user_data_dir(char **ret, const char *suffix) {
return -ENXIO;
- j = strjoin(home, "/.local/share", suffix, NULL);
+ j = strjoin(home, "/.local/share", suffix);
}
if (!j)
return -ENOMEM;