basic/strv: add STRPTR_IN_SET

Also some trivial tests for STR_IN_SET and STRPTR_IN_SET.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2016-09-24 20:13:28 -04:00
parent 72240b52f1
commit c7bf9d5183
2 changed files with 26 additions and 0 deletions
+5
View File
@@ -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 = ({ \