diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-10-23 11:43:27 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-10-23 11:43:27 -0400 |
commit | 605405c6cc934466951b0c6bad5a9553620bcb08 (patch) | |
tree | af4eb757a0508374d581f746e3ce6a3ca5606dbb /src/gpt-auto-generator | |
parent | 3c5d7c978c5f5e6fcc1d3175bb22dd1b3477f4b4 (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/gpt-auto-generator')
-rw-r--r-- | src/gpt-auto-generator/gpt-auto-generator.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index a098b27a8e..e64d5bb231 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -76,7 +76,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi if (r < 0) return log_error_errno(r, "Failed to generate unit name: %m"); - p = strjoin(arg_dest, "/", n, NULL); + p = strjoin(arg_dest, "/", n); if (!p) return log_oom(); @@ -111,7 +111,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi from = strjoina("../", n); - to = strjoin(arg_dest, "/", d, ".wants/", n, NULL); + to = strjoin(arg_dest, "/", d, ".wants/", n); if (!to) return log_oom(); @@ -120,7 +120,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi return log_error_errno(errno, "Failed to create symlink %s: %m", to); free(to); - to = strjoin(arg_dest, "/cryptsetup.target.requires/", n, NULL); + to = strjoin(arg_dest, "/cryptsetup.target.requires/", n); if (!to) return log_oom(); @@ -129,7 +129,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi return log_error_errno(errno, "Failed to create symlink %s: %m", to); free(to); - to = strjoin(arg_dest, "/dev-mapper-", e, ".device.requires/", n, NULL); + to = strjoin(arg_dest, "/dev-mapper-", e, ".device.requires/", n); if (!to) return log_oom(); @@ -138,7 +138,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi return log_error_errno(errno, "Failed to create symlink %s: %m", to); free(p); - p = strjoin(arg_dest, "/dev-mapper-", e, ".device.d/50-job-timeout-sec-0.conf", NULL); + p = strjoin(arg_dest, "/dev-mapper-", e, ".device.d/50-job-timeout-sec-0.conf"); if (!p) return log_oom(); @@ -194,7 +194,7 @@ static int add_mount( if (r < 0) return log_error_errno(r, "Failed to generate unit name: %m"); - p = strjoin(arg_dest, "/", unit, NULL); + p = strjoin(arg_dest, "/", unit); if (!p) return log_oom(); @@ -236,7 +236,7 @@ static int add_mount( return log_error_errno(r, "Failed to write unit file %s: %m", p); if (post) { - lnk = strjoin(arg_dest, "/", post, ".requires/", unit, NULL); + lnk = strjoin(arg_dest, "/", post, ".requires/", unit); if (!lnk) return log_oom(); @@ -340,7 +340,7 @@ static int add_swap(const char *path) { if (r < 0) return log_error_errno(r, "Failed to generate unit name: %m"); - unit = strjoin(arg_dest, "/", name, NULL); + unit = strjoin(arg_dest, "/", name); if (!unit) return log_oom(); @@ -361,7 +361,7 @@ static int add_swap(const char *path) { if (r < 0) return log_error_errno(r, "Failed to write unit file %s: %m", unit); - lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name, NULL); + lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name); if (!lnk) return log_oom(); @@ -393,7 +393,7 @@ static int add_automount( assert(description); if (options) - opt = strjoin(options, ",noauto", NULL); + opt = strjoin(options, ",noauto"); else opt = strdup("noauto"); if (!opt) @@ -414,7 +414,7 @@ static int add_automount( if (r < 0) return log_error_errno(r, "Failed to generate unit name: %m"); - p = strjoin(arg_dest, "/", unit, NULL); + p = strjoin(arg_dest, "/", unit); if (!p) return log_oom(); @@ -438,7 +438,7 @@ static int add_automount( if (r < 0) return log_error_errno(r, "Failed to write unit file %s: %m", p); - lnk = strjoin(arg_dest, "/" SPECIAL_LOCAL_FS_TARGET ".wants/", unit, NULL); + lnk = strjoin(arg_dest, "/" SPECIAL_LOCAL_FS_TARGET ".wants/", unit); if (!lnk) return log_oom(); mkdir_parents_label(lnk, 0755); |