summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/basic/strv.c4
-rw-r--r--src/basic/strv.h3
-rw-r--r--src/basic/time-util.c2
-rw-r--r--src/core/service.c2
-rw-r--r--src/core/slice.c4
-rw-r--r--src/libsystemd/sd-bus/test-bus-objects.c4
-rw-r--r--src/machine/machine-dbus.c2
-rw-r--r--src/shared/ask-password-api.c2
-rw-r--r--src/shared/conf-parser.c2
-rw-r--r--src/shared/install.c2
-rw-r--r--src/shared/path-lookup.c15
-rw-r--r--src/shared/sleep-config.c10
-rw-r--r--src/systemctl/systemctl.c2
-rw-r--r--src/sysv-generator/sysv-generator.c2
-rw-r--r--src/test/test-env-util.c17
-rw-r--r--src/test/test-exec-util.c3
-rw-r--r--src/test/test-nss.c7
-rw-r--r--src/test/test-path-util.c2
-rw-r--r--src/test/test-serialize.c5
-rw-r--r--src/test/test-sleep.c16
-rw-r--r--src/test/test-strv.c53
21 files changed, 76 insertions, 83 deletions
diff --git a/src/basic/strv.c b/src/basic/strv.c
index 1bab723e88..3a62f25ded 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -169,7 +169,7 @@ char **strv_new_ap(const char *x, va_list ap) {
return TAKE_PTR(a);
}
-char **strv_new(const char *x, ...) {
+char **strv_new_internal(const char *x, ...) {
char **r;
va_list ap;
@@ -658,7 +658,7 @@ char **strv_split_nulstr(const char *s) {
}
if (!r)
- return strv_new(NULL, NULL);
+ return strv_new(NULL);
return r;
}
diff --git a/src/basic/strv.h b/src/basic/strv.h
index e9e6063f58..5f1803d87d 100644
--- a/src/basic/strv.h
+++ b/src/basic/strv.h
@@ -54,8 +54,9 @@ bool strv_equal(char **a, char **b);
#define strv_contains(l, s) (!!strv_find((l), (s)))
-char **strv_new(const char *x, ...) _sentinel_;
+char **strv_new_internal(const char *x, ...) _sentinel_;
char **strv_new_ap(const char *x, va_list ap);
+#define strv_new(...) strv_new_internal(__VA_ARGS__, NULL)
#define STRV_IGNORE ((const char *) -1)
diff --git a/src/basic/time-util.c b/src/basic/time-util.c
index e351684219..141b91f637 100644
--- a/src/basic/time-util.c
+++ b/src/basic/time-util.c
@@ -1190,7 +1190,7 @@ int get_timezones(char ***ret) {
assert(ret);
- zones = strv_new("UTC", NULL);
+ zones = strv_new("UTC");
if (!zones)
return -ENOMEM;
diff --git a/src/core/service.c b/src/core/service.c
index 2a36cc03f3..f6f3ecc0e6 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1225,7 +1225,7 @@ static int service_collect_fds(
return -ENOMEM;
rfds[0] = s->socket_fd;
- rfd_names = strv_new("connection", NULL);
+ rfd_names = strv_new("connection");
if (!rfd_names)
return -ENOMEM;
diff --git a/src/core/slice.c b/src/core/slice.c
index a8bdbebe4b..74d056f7bc 100644
--- a/src/core/slice.c
+++ b/src/core/slice.c
@@ -124,7 +124,7 @@ static int slice_load_root_slice(Unit *u) {
if (!u->description)
u->description = strdup("Root Slice");
if (!u->documentation)
- u->documentation = strv_new("man:systemd.special(7)", NULL);
+ u->documentation = strv_new("man:systemd.special(7)");
return 1;
}
@@ -147,7 +147,7 @@ static int slice_load_system_slice(Unit *u) {
if (!u->description)
u->description = strdup("System Slice");
if (!u->documentation)
- u->documentation = strv_new("man:systemd.special(7)", NULL);
+ u->documentation = strv_new("man:systemd.special(7)");
return 1;
}
diff --git a/src/libsystemd/sd-bus/test-bus-objects.c b/src/libsystemd/sd-bus/test-bus-objects.c
index c12795b033..3c5bb88f4e 100644
--- a/src/libsystemd/sd-bus/test-bus-objects.c
+++ b/src/libsystemd/sd-bus/test-bus-objects.c
@@ -207,7 +207,7 @@ static const sd_bus_vtable vtable2[] = {
static int enumerator_callback(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error) {
if (object_path_startswith("/value", path))
- assert_se(*nodes = strv_new("/value/a", "/value/b", "/value/c", NULL));
+ assert_se(*nodes = strv_new("/value/a", "/value/b", "/value/c"));
return 1;
}
@@ -215,7 +215,7 @@ static int enumerator_callback(sd_bus *bus, const char *path, void *userdata, ch
static int enumerator2_callback(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error) {
if (object_path_startswith("/value/a", path))
- assert_se(*nodes = strv_new("/value/a/x", "/value/a/y", "/value/a/z", NULL));
+ assert_se(*nodes = strv_new("/value/a/x", "/value/a/y", "/value/a/z"));
return 1;
}
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
index 77e8b161b0..4f4d780db0 100644
--- a/src/machine/machine-dbus.c
+++ b/src/machine/machine-dbus.c
@@ -605,7 +605,7 @@ int bus_machine_method_open_shell(sd_bus_message *message, void *userdata, sd_bu
if (strv_isempty(args)) {
args = strv_free(args);
- args = strv_new(path, NULL);
+ args = strv_new(path);
if (!args)
return -ENOMEM;
}
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c
index 5f1c34c841..ae3dd33b7a 100644
--- a/src/shared/ask-password-api.c
+++ b/src/shared/ask-password-api.c
@@ -678,7 +678,7 @@ int ask_password_agent(
if (passphrase[0] == '+') {
/* An empty message refers to the empty password */
if (n == 1)
- l = strv_new("", NULL);
+ l = strv_new("");
else
l = strv_parse_nulstr(passphrase+1, n-1);
explicit_bzero_safe(passphrase, n);
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index b21ecee129..b9c5b412f2 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -1113,7 +1113,7 @@ int config_parse_join_controllers(
controllers = new(char**, 2);
if (!controllers)
return log_oom();
- controllers[0] = strv_new(NULL, NULL);
+ controllers[0] = strv_new(NULL);
if (!controllers[0])
return log_oom();
controllers[1] = NULL;
diff --git a/src/shared/install.c b/src/shared/install.c
index d806bc69ff..d08d0af7b5 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -2446,7 +2446,7 @@ int unit_file_add_dependency(
l = &i->required_by;
strv_free(*l);
- *l = strv_new(target_info->name, NULL);
+ *l = strv_new(target_info->name);
if (!*l)
return -ENOMEM;
}
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index 075f4d1e6c..dc06502c81 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -137,8 +137,7 @@ int xdg_user_dirs(char ***ret_config_dirs, char ***ret_data_dirs) {
data_dirs = strv_split(e, ":");
else
data_dirs = strv_new("/usr/local/share",
- "/usr/share",
- NULL);
+ "/usr/share");
if (!data_dirs)
return -ENOMEM;
@@ -616,8 +615,7 @@ int lookup_paths_init(
SYSTEM_DATA_UNIT_PATH,
"/usr/lib/systemd/system",
STRV_IFNOTNULL(flags & LOOKUP_PATHS_SPLIT_USR ? "/lib/systemd/system" : NULL),
- STRV_IFNOTNULL(generator_late),
- NULL);
+ STRV_IFNOTNULL(generator_late));
break;
case UNIT_FILE_GLOBAL:
@@ -640,8 +638,7 @@ int lookup_paths_init(
"/usr/local/lib/systemd/user",
USER_DATA_UNIT_PATH,
"/usr/lib/systemd/user",
- STRV_IFNOTNULL(generator_late),
- NULL);
+ STRV_IFNOTNULL(generator_late));
break;
case UNIT_FILE_USER:
@@ -891,16 +888,14 @@ char **generator_binary_paths(UnitFileScope scope) {
return strv_new("/run/systemd/system-generators",
"/etc/systemd/system-generators",
"/usr/local/lib/systemd/system-generators",
- SYSTEM_GENERATOR_PATH,
- NULL);
+ SYSTEM_GENERATOR_PATH);
case UNIT_FILE_GLOBAL:
case UNIT_FILE_USER:
return strv_new("/run/systemd/user-generators",
"/etc/systemd/user-generators",
"/usr/local/lib/systemd/user-generators",
- USER_GENERATOR_PATH,
- NULL);
+ USER_GENERATOR_PATH);
default:
assert_not_reached("Hmm, unexpected scope.");
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 6778399188..3270ea3c4a 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -73,7 +73,7 @@ int parse_sleep_config(const char *verb, bool *ret_allow, char ***ret_modes, cha
if (suspend_state)
states = TAKE_PTR(suspend_state);
else
- states = strv_new("mem", "standby", "freeze", NULL);
+ states = strv_new("mem", "standby", "freeze");
} else if (streq(verb, "hibernate")) {
allow = allow_hibernate != 0;
@@ -81,12 +81,12 @@ int parse_sleep_config(const char *verb, bool *ret_allow, char ***ret_modes, cha
if (hibernate_mode)
modes = TAKE_PTR(hibernate_mode);
else
- modes = strv_new("platform", "shutdown", NULL);
+ modes = strv_new("platform", "shutdown");
if (hibernate_state)
states = TAKE_PTR(hibernate_state);
else
- states = strv_new("disk", NULL);
+ states = strv_new("disk");
} else if (streq(verb, "hybrid-sleep")) {
allow = allow_hybrid_sleep > 0 ||
@@ -95,12 +95,12 @@ int parse_sleep_config(const char *verb, bool *ret_allow, char ***ret_modes, cha
if (hybrid_mode)
modes = TAKE_PTR(hybrid_mode);
else
- modes = strv_new("suspend", "platform", "shutdown", NULL);
+ modes = strv_new("suspend", "platform", "shutdown");
if (hybrid_state)
states = TAKE_PTR(hybrid_state);
else
- states = strv_new("disk", NULL);
+ states = strv_new("disk");
} else if (streq(verb, "suspend-then-hibernate")) {
allow = allow_s2h > 0 ||
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index d446a2c588..9d0c40b93c 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -3071,7 +3071,7 @@ static int start_unit(int argc, char *argv[], void *userdata) {
}
if (one_name) {
- names = strv_new(one_name, NULL);
+ names = strv_new(one_name);
if (!names)
return log_oom();
} else {
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 65313d4416..1566895ba3 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -717,7 +717,7 @@ static int acquire_search_path(const char *def, const char *envvar, char ***ret)
if (strv_isempty(l)) {
strv_free(l);
- l = strv_new(def, NULL);
+ l = strv_new(def);
if (!l)
return log_oom();
}
diff --git a/src/test/test-env-util.c b/src/test/test-env-util.c
index ee9734fd66..4c33c7c13c 100644
--- a/src/test/test-env-util.c
+++ b/src/test/test-env-util.c
@@ -15,13 +15,13 @@
static void test_strv_env_delete(void) {
_cleanup_strv_free_ char **a = NULL, **b = NULL, **c = NULL, **d = NULL;
- a = strv_new("FOO=BAR", "WALDO=WALDO", "WALDO=", "PIEP", "SCHLUMPF=SMURF", NULL);
+ a = strv_new("FOO=BAR", "WALDO=WALDO", "WALDO=", "PIEP", "SCHLUMPF=SMURF");
assert_se(a);
- b = strv_new("PIEP", "FOO", NULL);
+ b = strv_new("PIEP", "FOO");
assert_se(b);
- c = strv_new("SCHLUMPF", NULL);
+ c = strv_new("SCHLUMPF");
assert_se(c);
d = strv_env_delete(a, 2, b, c);
@@ -45,7 +45,7 @@ static void test_strv_env_get(void) {
static void test_strv_env_unset(void) {
_cleanup_strv_free_ char **l = NULL;
- l = strv_new("PIEP", "SCHLUMPF=SMURFF", "NANANANA=YES", NULL);
+ l = strv_new("PIEP", "SCHLUMPF=SMURFF", "NANANANA=YES");
assert_se(l);
assert_se(strv_env_unset(l, "SCHLUMPF") == l);
@@ -58,7 +58,7 @@ static void test_strv_env_unset(void) {
static void test_strv_env_set(void) {
_cleanup_strv_free_ char **l = NULL, **r = NULL;
- l = strv_new("PIEP", "SCHLUMPF=SMURFF", "NANANANA=YES", NULL);
+ l = strv_new("PIEP", "SCHLUMPF=SMURFF", "NANANANA=YES");
assert_se(l);
r = strv_env_set(l, "WALDO=WALDO");
@@ -74,10 +74,10 @@ static void test_strv_env_set(void) {
static void test_strv_env_merge(void) {
_cleanup_strv_free_ char **a = NULL, **b = NULL, **r = NULL;
- a = strv_new("FOO=BAR", "WALDO=WALDO", "WALDO=", "PIEP", "SCHLUMPF=SMURF", NULL);
+ a = strv_new("FOO=BAR", "WALDO=WALDO", "WALDO=", "PIEP", "SCHLUMPF=SMURF");
assert_se(a);
- b = strv_new("FOO=KKK", "FOO=", "PIEP=", "SCHLUMPF=SMURFF", "NANANANA=YES", NULL);
+ b = strv_new("FOO=KKK", "FOO=", "PIEP=", "SCHLUMPF=SMURFF", "NANANANA=YES");
assert_se(b);
r = strv_env_merge(2, a, b);
@@ -250,8 +250,7 @@ static void test_env_clean(void) {
"xyz\n=xyz",
"xyz=xyz\n",
"another=one",
- "another=final one",
- NULL);
+ "another=final one");
assert_se(e);
assert_se(!strv_env_is_valid(e));
assert_se(strv_env_clean(e) == e);
diff --git a/src/test/test-exec-util.c b/src/test/test-exec-util.c
index e74b95231d..21a4538d74 100644
--- a/src/test/test-exec-util.c
+++ b/src/test/test-exec-util.c
@@ -346,7 +346,8 @@ static void test_environment_gathering(void) {
/* now retest with "default" path passed in, as created by
* manager_default_environment */
env = strv_free(env);
- env = strv_new("PATH=" DEFAULT_PATH, NULL);
+ env = strv_new("PATH=" DEFAULT_PATH);
+ assert_se(env);
r = execute_directories(dirs, DEFAULT_TIMEOUT_USEC, gather_environment, args, NULL, env);
assert_se(r >= 0);
diff --git a/src/test/test-nss.c b/src/test/test-nss.c
index d9440682d2..20aa6cf01f 100644
--- a/src/test/test-nss.c
+++ b/src/test/test-nss.c
@@ -424,7 +424,7 @@ static int parse_argv(int argc, char **argv,
size_t n_allocated = 0;
if (argc > 1)
- modules = strv_new(argv[1], NULL);
+ modules = strv_new(argv[1]);
else
modules = strv_new(
#if ENABLE_NSS_MYHOSTNAME
@@ -436,8 +436,7 @@ static int parse_argv(int argc, char **argv,
#if ENABLE_NSS_MYMACHINES
"mymachines",
#endif
- "dns",
- NULL);
+ "dns");
if (!modules)
return -ENOMEM;
@@ -468,7 +467,7 @@ static int parse_argv(int argc, char **argv,
if (!hostname)
return -ENOMEM;
- names = strv_new("localhost", "_gateway", "foo_no_such_host", hostname, NULL);
+ names = strv_new("localhost", "_gateway", "foo_no_such_host", hostname);
if (!names)
return -ENOMEM;
diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c
index 8b9686d50b..fd5f598701 100644
--- a/src/test/test-path-util.c
+++ b/src/test/test-path-util.c
@@ -293,7 +293,7 @@ static void test_strv_resolve(void) {
assert_se(mkdtemp(tmp_dir) != NULL);
- search_dirs = strv_new("/dir1", "/dir2", "/dir3", NULL);
+ search_dirs = strv_new("/dir1", "/dir2", "/dir3");
assert_se(search_dirs);
STRV_FOREACH(d, search_dirs) {
char *p = strappend(tmp_dir, *d);
diff --git a/src/test/test-serialize.c b/src/test/test-serialize.c
index b70eb3daa7..9a16688a67 100644
--- a/src/test/test-serialize.c
+++ b/src/test/test-serialize.c
@@ -138,7 +138,7 @@ static void test_deserialize_environment(void) {
log_info("/* %s */", __func__);
- assert_se(env = strv_new("A=1", NULL));
+ assert_se(env = strv_new("A=1"));
assert_se(deserialize_environment("B=2", &env) >= 0);
assert_se(deserialize_environment("FOO%%=a\\177b\\nc\\td e", &env) >= 0);
@@ -162,8 +162,7 @@ static void test_serialize_environment(void) {
"B=2",
"C=ąęółń",
"D=D=a\\x0Ab",
- "FOO%%=a\177b\nc\td e",
- NULL));
+ "FOO%%=a\177b\nc\td e"));
assert_se(serialize_strv(f, "env", env) == 1);
assert_se(fflush_and_check(f) == 0);
diff --git a/src/test/test-sleep.c b/src/test/test-sleep.c
index 442541a298..2a6d5e765a 100644
--- a/src/test/test-sleep.c
+++ b/src/test/test-sleep.c
@@ -50,14 +50,14 @@ static int test_fiemap(const char *path) {
static void test_sleep(void) {
_cleanup_strv_free_ char
- **standby = strv_new("standby", NULL),
- **mem = strv_new("mem", NULL),
- **disk = strv_new("disk", NULL),
- **suspend = strv_new("suspend", NULL),
- **reboot = strv_new("reboot", NULL),
- **platform = strv_new("platform", NULL),
- **shutdown = strv_new("shutdown", NULL),
- **freez = strv_new("freeze", NULL);
+ **standby = strv_new("standby"),
+ **mem = strv_new("mem"),
+ **disk = strv_new("disk"),
+ **suspend = strv_new("suspend"),
+ **reboot = strv_new("reboot"),
+ **platform = strv_new("platform"),
+ **shutdown = strv_new("shutdown"),
+ **freez = strv_new("freeze");
int r;
log_info("/* %s */", __func__);
diff --git a/src/test/test-strv.c b/src/test/test-strv.c
index 5e392c75ac..63757afdce 100644
--- a/src/test/test-strv.c
+++ b/src/test/test-strv.c
@@ -441,8 +441,8 @@ static void test_strv_sort(void) {
static void test_strv_extend_strv_concat(void) {
_cleanup_strv_free_ char **a = NULL, **b = NULL;
- a = strv_new("without", "suffix", NULL);
- b = strv_new("with", "suffix", NULL);
+ a = strv_new("without", "suffix");
+ b = strv_new("with", "suffix");
assert_se(a);
assert_se(b);
@@ -457,8 +457,8 @@ static void test_strv_extend_strv_concat(void) {
static void test_strv_extend_strv(void) {
_cleanup_strv_free_ char **a = NULL, **b = NULL, **n = NULL;
- a = strv_new("abc", "def", "ghi", NULL);
- b = strv_new("jkl", "mno", "abc", "pqr", NULL);
+ a = strv_new("abc", "def", "ghi");
+ b = strv_new("jkl", "mno", "abc", "pqr");
assert_se(a);
assert_se(b);
@@ -483,7 +483,7 @@ static void test_strv_extend_strv(void) {
static void test_strv_extend(void) {
_cleanup_strv_free_ char **a = NULL, **b = NULL;
- a = strv_new("test", "test1", NULL);
+ a = strv_new("test", "test1");
assert_se(a);
assert_se(strv_extend(&a, "test2") >= 0);
assert_se(strv_extend(&b, "test3") >= 0);
@@ -497,7 +497,7 @@ static void test_strv_extend(void) {
static void test_strv_extendf(void) {
_cleanup_strv_free_ char **a = NULL, **b = NULL;
- a = strv_new("test", "test1", NULL);
+ a = strv_new("test", "test1");
assert_se(a);
assert_se(strv_extendf(&a, "test2 %s %d %s", "foo", 128, "bar") >= 0);
assert_se(strv_extendf(&b, "test3 %s %s %d", "bar", "foo", 128) >= 0);
@@ -513,7 +513,7 @@ static void test_strv_foreach(void) {
unsigned i = 0;
char **check;
- a = strv_new("one", "two", "three", NULL);
+ a = strv_new("one", "two", "three");
assert_se(a);
@@ -527,7 +527,7 @@ static void test_strv_foreach_backwards(void) {
unsigned i = 2;
char **check;
- a = strv_new("one", "two", "three", NULL);
+ a = strv_new("one", "two", "three");
assert_se(a);
@@ -547,8 +547,7 @@ static void test_strv_foreach_pair(void) {
a = strv_new("pair_one", "pair_one",
"pair_two", "pair_two",
- "pair_three", "pair_three",
- NULL);
+ "pair_three", "pair_three");
STRV_FOREACH_PAIR(x, y, a) {
assert_se(streq(*x, *y));
@@ -608,7 +607,7 @@ static void test_strv_insert(void) {
static void test_strv_push_prepend(void) {
_cleanup_strv_free_ char **a = NULL;
- a = strv_new("foo", "bar", "three", NULL);
+ a = strv_new("foo", "bar", "three");
assert_se(strv_push_prepend(&a, strdup("first")) >= 0);
assert_se(streq(a[0], "first"));
@@ -648,11 +647,11 @@ static void test_strv_equal(void) {
_cleanup_strv_free_ char **b = NULL;
_cleanup_strv_free_ char **c = NULL;
- a = strv_new("one", "two", "three", NULL);
+ a = strv_new("one", "two", "three");
assert_se(a);
- b = strv_new("one", "two", "three", NULL);
+ b = strv_new("one", "two", "three");
assert_se(a);
- c = strv_new("one", "two", "three", "four", NULL);
+ c = strv_new("one", "two", "three", "four");
assert_se(a);
assert_se(strv_equal(a, a));
@@ -667,19 +666,19 @@ static void test_strv_equal(void) {
static void test_strv_is_uniq(void) {
_cleanup_strv_free_ char **a = NULL, **b = NULL, **c = NULL, **d = NULL;
- a = strv_new(NULL, NULL);
+ a = strv_new(NULL);
assert_se(a);
assert_se(strv_is_uniq(a));
- b = strv_new("foo", NULL);
+ b = strv_new("foo");
assert_se(b);
assert_se(strv_is_uniq(b));
- c = strv_new("foo", "bar", NULL);
+ c = strv_new("foo", "bar");
assert_se(c);
assert_se(strv_is_uniq(c));
- d = strv_new("foo", "bar", "waldo", "bar", "piep", NULL);
+ d = strv_new("foo", "bar", "waldo", "bar", "piep");
assert_se(d);
assert_se(!strv_is_uniq(d));
}
@@ -687,26 +686,26 @@ static void test_strv_is_uniq(void) {
static void test_strv_reverse(void) {
_cleanup_strv_free_ char **a = NULL, **b = NULL, **c = NULL, **d = NULL;
- a = strv_new(NULL, NULL);
+ a = strv_new(NULL);
assert_se(a);
strv_reverse(a);
assert_se(strv_isempty(a));
- b = strv_new("foo", NULL);
+ b = strv_new("foo");
assert_se(b);
strv_reverse(b);
assert_se(streq_ptr(b[0], "foo"));
assert_se(streq_ptr(b[1], NULL));
- c = strv_new("foo", "bar", NULL);
+ c = strv_new("foo", "bar");
assert_se(c);
strv_reverse(c);
assert_se(streq_ptr(c[0], "bar"));
assert_se(streq_ptr(c[1], "foo"));
assert_se(streq_ptr(c[2], NULL));
- d = strv_new("foo", "bar", "waldo", NULL);
+ d = strv_new("foo", "bar", "waldo");
assert_se(d);
strv_reverse(d);
assert_se(streq_ptr(d[0], "waldo"));
@@ -718,7 +717,7 @@ static void test_strv_reverse(void) {
static void test_strv_shell_escape(void) {
_cleanup_strv_free_ char **v = NULL;
- v = strv_new("foo:bar", "bar,baz", "wal\\do", NULL);
+ v = strv_new("foo:bar", "bar,baz", "wal\\do");
assert_se(v);
assert_se(strv_shell_escape(v, ",:"));
assert_se(streq_ptr(v[0], "foo\\:bar"));
@@ -752,7 +751,7 @@ static void test_strv_skip(void) {
static void test_strv_extend_n(void) {
_cleanup_strv_free_ char **v = NULL;
- v = strv_new("foo", "bar", NULL);
+ v = strv_new("foo", "bar");
assert_se(v);
assert_se(strv_extend_n(&v, "waldo", 3) >= 0);
@@ -808,8 +807,8 @@ static void test_strv_free_free(void) {
char ***t;
assert_se(t = new(char**, 3));
- assert_se(t[0] = strv_new("a", "b", NULL));
- assert_se(t[1] = strv_new("c", "d", "e", NULL));
+ assert_se(t[0] = strv_new("a", "b"));
+ assert_se(t[1] = strv_new("c", "d", "e"));
t[2] = NULL;
t = strv_free_free(t);
@@ -839,7 +838,7 @@ static void test_strv_fnmatch(void) {
assert_se(!strv_fnmatch(STRV_MAKE_EMPTY, "a", 0));
- v = strv_new("*\\*", NULL);
+ v = strv_new("*\\*");
assert_se(!strv_fnmatch(v, "\\", 0));
assert_se(strv_fnmatch(v, "\\", FNM_NOESCAPE));
}