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/resolve | |
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/resolve')
-rw-r--r-- | src/resolve/resolved-dns-dnssec.c | 2 | ||||
-rw-r--r-- | src/resolve/resolved-dns-rr.c | 14 | ||||
-rw-r--r-- | src/resolve/test-dnssec-complex.c | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/resolve/resolved-dns-dnssec.c b/src/resolve/resolved-dns-dnssec.c index d4a267c89f..51327105d0 100644 --- a/src/resolve/resolved-dns-dnssec.c +++ b/src/resolve/resolved-dns-dnssec.c @@ -1303,7 +1303,7 @@ static int nsec3_hashed_domain_format(const uint8_t *hashed, size_t hashed_size, if (!l) return -ENOMEM; - j = strjoin(l, ".", zone, NULL); + j = strjoin(l, ".", zone); if (!j) return -ENOMEM; diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c index 87e4abec6e..209d565033 100644 --- a/src/resolve/resolved-dns-rr.c +++ b/src/resolve/resolved-dns-rr.c @@ -792,7 +792,7 @@ static char *format_types(Bitmap *types) { if (!str) return NULL; - return strjoin("( ", str, " )", NULL); + return strjoin("( ", str, " )"); } static char *format_txt(DnsTxtItem *first) { @@ -861,14 +861,14 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) { case DNS_TYPE_NS: case DNS_TYPE_CNAME: case DNS_TYPE_DNAME: - s = strjoin(k, " ", rr->ptr.name, NULL); + s = strjoin(k, " ", rr->ptr.name); if (!s) return NULL; break; case DNS_TYPE_HINFO: - s = strjoin(k, " ", rr->hinfo.cpu, " ", rr->hinfo.os, NULL); + s = strjoin(k, " ", rr->hinfo.cpu, " ", rr->hinfo.os); if (!s) return NULL; break; @@ -879,7 +879,7 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) { if (!t) return NULL; - s = strjoin(k, " ", t, NULL); + s = strjoin(k, " ", t); if (!s) return NULL; break; @@ -891,7 +891,7 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) { if (r < 0) return NULL; - s = strjoin(k, " ", x, NULL); + s = strjoin(k, " ", x); if (!s) return NULL; break; @@ -902,7 +902,7 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) { if (r < 0) return NULL; - s = strjoin(k, " ", t, NULL); + s = strjoin(k, " ", t); if (!s) return NULL; break; @@ -942,7 +942,7 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) { if (!t) return NULL; - s = strjoin(k, " ", t, NULL); + s = strjoin(k, " ", t); if (!s) return NULL; break; diff --git a/src/resolve/test-dnssec-complex.c b/src/resolve/test-dnssec-complex.c index 58c089eb40..3d7074af11 100644 --- a/src/resolve/test-dnssec-complex.c +++ b/src/resolve/test-dnssec-complex.c @@ -42,7 +42,7 @@ static void prefix_random(const char *name, char **ret) { char *x; assert_se(asprintf(&b, "x%" PRIu64 "x", random_u64())); - x = strjoin(b, ".", name, NULL); + x = strjoin(b, ".", name); assert_se(x); free(m); |