summaryrefslogtreecommitdiff
path: root/src/test
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/test
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/test')
-rw-r--r--src/test/test-copy.c4
-rw-r--r--src/test/test-date.c4
-rw-r--r--src/test/test-fileio.c2
-rw-r--r--src/test/test-namespace.c8
-rw-r--r--src/test/test-path.c2
-rw-r--r--src/test/test-replace-var.c2
6 files changed, 11 insertions, 11 deletions
diff --git a/src/test/test-copy.c b/src/test/test-copy.c
index ed1ea51dbd..91e4e5b409 100644
--- a/src/test/test-copy.c
+++ b/src/test/test-copy.c
@@ -141,8 +141,8 @@ static void test_copy_tree(void) {
STRV_FOREACH_PAIR(link, p, links) {
_cleanup_free_ char *target = NULL, *f, *l;
- assert_se(f = strjoin(original_dir, *p, NULL));
- assert_se(l = strjoin(copy_dir, *link, NULL));
+ assert_se(f = strjoin(original_dir, *p));
+ assert_se(l = strjoin(copy_dir, *link));
assert_se(readlink_and_canonicalize(l, &target) == 0);
assert_se(path_equal(f, target));
diff --git a/src/test/test-date.c b/src/test/test-date.c
index 7f497bb7d5..a8d3f1e083 100644
--- a/src/test/test-date.c
+++ b/src/test/test-date.c
@@ -60,7 +60,7 @@ static void test_one(const char *p) {
_cleanup_free_ char *with_utc;
log_info("Test: %s", p);
- with_utc = strjoin(p, " UTC", NULL);
+ with_utc = strjoin(p, " UTC");
test_should_pass(p);
test_should_pass(with_utc);
}
@@ -69,7 +69,7 @@ static void test_one_noutc(const char *p) {
_cleanup_free_ char *with_utc;
log_info("Test: %s", p);
- with_utc = strjoin(p, " UTC", NULL);
+ with_utc = strjoin(p, " UTC");
test_should_pass(p);
test_should_fail(with_utc);
}
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index 92663ef66f..56316904a3 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -367,7 +367,7 @@ static void test_write_string_file_verify(void) {
int r;
assert_se(read_one_line_file("/proc/cmdline", &buf) >= 0);
- assert_se((buf2 = strjoin(buf, "\n", NULL)));
+ assert_se((buf2 = strjoin(buf, "\n")));
r = write_string_file("/proc/cmdline", buf, 0);
assert_se(r == -EACCES || r == -EIO);
diff --git a/src/test/test-namespace.c b/src/test/test-namespace.c
index ff9f35cecd..de7be1f9cc 100644
--- a/src/test/test-namespace.c
+++ b/src/test/test-namespace.c
@@ -132,14 +132,14 @@ int main(int argc, char *argv[]) {
assert_se(sd_id128_get_boot(&bid) >= 0);
sd_id128_to_string(bid, boot_id);
- x = strjoin("/tmp/systemd-private-", boot_id, "-abcd.service-", NULL);
- y = strjoin("/var/tmp/systemd-private-", boot_id, "-abcd.service-", NULL);
+ x = strjoin("/tmp/systemd-private-", boot_id, "-abcd.service-");
+ y = strjoin("/var/tmp/systemd-private-", boot_id, "-abcd.service-");
assert_se(x && y);
test_tmpdir("abcd.service", x, y);
- z = strjoin("/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-", NULL);
- zz = strjoin("/var/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-", NULL);
+ z = strjoin("/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-");
+ zz = strjoin("/var/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-");
assert_se(z && zz);
diff --git a/src/test/test-path.c b/src/test/test-path.c
index 4d3f0e9948..5e99d478ee 100644
--- a/src/test/test-path.c
+++ b/src/test/test-path.c
@@ -56,7 +56,7 @@ static int setup_test(Manager **m) {
STRV_FOREACH(test_path, tests_path) {
_cleanup_free_ char *p = NULL;
- p = strjoin("/tmp/test-path_", *test_path, NULL);
+ p = strjoin("/tmp/test-path_", *test_path);
assert_se(p);
(void) rm_rf(p, REMOVE_ROOT|REMOVE_PHYSICAL);
diff --git a/src/test/test-replace-var.c b/src/test/test-replace-var.c
index 297effce79..60e05d04c9 100644
--- a/src/test/test-replace-var.c
+++ b/src/test/test-replace-var.c
@@ -25,7 +25,7 @@
#include "util.h"
static char *lookup(const char *variable, void *userdata) {
- return strjoin("<<<", variable, ">>>", NULL);
+ return strjoin("<<<", variable, ">>>");
}
int main(int argc, char *argv[]) {