} while (false)
#define STRV_MAKE(...) ((char**) ((const char*[]) { __VA_ARGS__, NULL }))
-#define STRV_MAKE_EMPTY ((char*[1]) { NULL })
+#define STRV_EMPTY ((char*[1]) { NULL })
#define STRV_MAKE_CONST(...) ((const char* const*) ((const char*[]) { __VA_ARGS__, NULL }))
/* Pointers range from NULL to POINTER_MAX */
}
TEST(config_parse_strv) {
- test_config_parse_strv_one("", false, STRV_MAKE_EMPTY);
+ test_config_parse_strv_one("", false, STRV_EMPTY);
test_config_parse_strv_one("foo", false, STRV_MAKE("foo"));
test_config_parse_strv_one("foo bar foo", false, STRV_MAKE("foo", "bar", "foo"));
test_config_parse_strv_one("\"foo bar\" foo", false, STRV_MAKE("foo bar", "foo"));
test_config_parse_strv_one("\xc3\x80", false, STRV_MAKE("\xc3\x80"));
test_config_parse_strv_one("\xc3\x7f", false, STRV_MAKE("\xc3\x7f"));
- test_config_parse_strv_one("", true, STRV_MAKE_EMPTY);
+ test_config_parse_strv_one("", true, STRV_EMPTY);
test_config_parse_strv_one("foo", true, STRV_MAKE("foo"));
test_config_parse_strv_one("foo bar foo", true, STRV_MAKE("foo", "bar"));
test_config_parse_strv_one("\"foo bar\" foo", true, STRV_MAKE("foo bar", "foo"));
STRV_MAKE("hoge", "hoge2", "hoge3", "", "hoge5", "", "xxx"));
strv_parse_nulstr_full_one(((const char[0]) {}), 0,
- STRV_MAKE_EMPTY, STRV_MAKE_EMPTY);
+ STRV_EMPTY, STRV_EMPTY);
strv_parse_nulstr_full_one(((const char[1]) { 0 }), 1,
- STRV_MAKE(""), STRV_MAKE_EMPTY);
+ STRV_MAKE(""), STRV_EMPTY);
strv_parse_nulstr_full_one(((const char[1]) { 'x' }), 1,
STRV_MAKE("x"), STRV_MAKE("x"));
strv_parse_nulstr_full_one(((const char[2]) { 0, 0 }), 2,
- STRV_MAKE("", ""), STRV_MAKE_EMPTY);
+ STRV_MAKE("", ""), STRV_EMPTY);
strv_parse_nulstr_full_one(((const char[2]) { 'x', 0 }), 2,
STRV_MAKE("x"), STRV_MAKE("x"));
strv_parse_nulstr_full_one(((const char[3]) { 0, 0, 0 }), 3,
- STRV_MAKE("", "", ""), STRV_MAKE_EMPTY);
+ STRV_MAKE("", "", ""), STRV_EMPTY);
strv_parse_nulstr_full_one(((const char[3]) { 'x', 0, 0 }), 3,
STRV_MAKE("x", ""), STRV_MAKE("x"));
TEST(proc_cmdline_filter_pid1_args) {
test_proc_cmdline_filter_pid1_args_one("systemd\0",
- STRV_MAKE_EMPTY);
+ STRV_EMPTY);
/* short option */
test_proc_cmdline_filter_pid1_args_one("systemd\0"
log_info("/* %s (%s) */", __func__, fn);
assert_se(serialize_strv(f, "strv1", NULL) == 0);
- assert_se(serialize_strv(f, "strv2", STRV_MAKE_EMPTY) == 0);
+ assert_se(serialize_strv(f, "strv2", STRV_EMPTY) == 0);
assert_se(serialize_strv(f, "strv3", strv) == 1);
assert_se(serialize_strv(f, "strv4", STRV_MAKE(long_string)) == -EINVAL);
assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "2000", STRV_MAKE("ipv6:2001-2002"), STRV_MAKE("any")) >= 0);
assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "6666", STRV_MAKE("ipv4:6666", "6667"), STRV_MAKE("any")) >= 0);
assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "6666", STRV_MAKE("6667", "6668", ""), STRV_MAKE("any")) >= 0);
- assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "7777", STRV_MAKE_EMPTY, STRV_MAKE_EMPTY) >= 0);
+ assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "7777", STRV_EMPTY, STRV_EMPTY) >= 0);
assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "8888", STRV_MAKE("any"), STRV_MAKE("any")) >= 0);
assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "8888", STRV_MAKE("ipv6:tcp:8888-8889"), STRV_MAKE("any")) >= 0);
assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "10000", STRV_MAKE("ipv6:udp:9999-10000"), STRV_MAKE("any")) >= 0);
true);
check("test\\",
- STRV_MAKE_EMPTY,
+ STRV_EMPTY,
true);
}
TEST(strv_unquote) {
test_strv_unquote_one(" foo=bar \"waldo\" zzz ", STRV_MAKE("foo=bar", "waldo", "zzz"));
- test_strv_unquote_one("", STRV_MAKE_EMPTY);
- test_strv_unquote_one(" ", STRV_MAKE_EMPTY);
- test_strv_unquote_one(" ", STRV_MAKE_EMPTY);
+ test_strv_unquote_one("", STRV_EMPTY);
+ test_strv_unquote_one(" ", STRV_EMPTY);
+ test_strv_unquote_one(" ", STRV_EMPTY);
test_strv_unquote_one(" x", STRV_MAKE("x"));
test_strv_unquote_one("x ", STRV_MAKE("x"));
test_strv_unquote_one(" x ", STRV_MAKE("x"));
STRV_FOREACH_BACKWARDS(check, (char**) NULL)
assert_not_reached();
- STRV_FOREACH_BACKWARDS(check, STRV_MAKE_EMPTY)
+ STRV_FOREACH_BACKWARDS(check, STRV_EMPTY)
assert_not_reached();
unsigned count = 0;
_cleanup_strv_free_ char **v = NULL;
size_t pos;
- assert_se(!strv_fnmatch(STRV_MAKE_EMPTY, "a"));
+ assert_se(!strv_fnmatch(STRV_EMPTY, "a"));
v = strv_new("xxx", "*\\*", "yyy");
assert_se(!strv_fnmatch_full(v, "\\", 0, NULL));
test_dispatch_one(STRV_MAKE("copy-to", "foo", "bar", "baz", "quux", "qaax"), verbs, -EINVAL);
/* no verb, but a default is set */
- test_dispatch_one(STRV_MAKE_EMPTY, verbs, 0);
+ test_dispatch_one(STRV_EMPTY, verbs, 0);
}
TEST(verbs_no_default) {