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/core/execute.c | |
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/core/execute.c')
-rw-r--r-- | src/core/execute.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index 1b7b4a928d..23a702e93e 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -1630,7 +1630,7 @@ static int build_environment( if (!joined) return -ENOMEM; - x = strjoin("LISTEN_FDNAMES=", joined, NULL); + x = strjoin("LISTEN_FDNAMES=", joined); if (!x) return -ENOMEM; our_env[n_env++] = x; @@ -1737,7 +1737,7 @@ static int build_pass_environment(const ExecContext *c, char ***ret) { v = getenv(*i); if (!v) continue; - x = strjoin(*i, "=", v, NULL); + x = strjoin(*i, "=", v); if (!x) return -ENOMEM; if (!GREEDY_REALLOC(pass_env, n_bufsize, n_env + 2)) @@ -1951,7 +1951,7 @@ static int setup_runtime_directory( STRV_FOREACH(rt, context->runtime_directory) { _cleanup_free_ char *p; - p = strjoin(params->runtime_prefix, "/", *rt, NULL); + p = strjoin(params->runtime_prefix, "/", *rt); if (!p) return -ENOMEM; @@ -2027,7 +2027,7 @@ static int compile_read_write_paths( STRV_FOREACH(rt, context->runtime_directory) { char *s; - s = strjoin(params->runtime_prefix, "/", *rt, NULL); + s = strjoin(params->runtime_prefix, "/", *rt); if (!s) return -ENOMEM; @@ -3006,7 +3006,7 @@ int exec_context_destroy_runtime_directory(ExecContext *c, const char *runtime_p STRV_FOREACH(i, c->runtime_directory) { _cleanup_free_ char *p; - p = strjoin(runtime_prefix, "/", *i, NULL); + p = strjoin(runtime_prefix, "/", *i); if (!p) return -ENOMEM; |