summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-09-24 20:13:28 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-09-24 20:13:28 -0400
commitc7bf9d5183deef8c8c01c86de2bc1bcbca7d3bff (patch)
treeca9b5f891c0457f53ed5776b91bfb0c5129ffcd4 /src/basic
parent72240b52f1d66b3d255ede56e6f70a155f1acae1 (diff)
basic/strv: add STRPTR_IN_SET
Also some trivial tests for STR_IN_SET and STRPTR_IN_SET.
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/strv.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/basic/strv.h b/src/basic/strv.h
index 683ce83a2a..fec2597db0 100644
--- a/src/basic/strv.h
+++ b/src/basic/strv.h
@@ -141,6 +141,11 @@ void strv_print(char **l);
})
#define STR_IN_SET(x, ...) strv_contains(STRV_MAKE(__VA_ARGS__), x)
+#define STRPTR_IN_SET(x, ...) \
+ ({ \
+ const char* _x = (x); \
+ _x && strv_contains(STRV_MAKE(__VA_ARGS__), _x); \
+ })
#define FOREACH_STRING(x, ...) \
for (char **_l = ({ \