From 7dd230537883c50e572752574e08c94aef5efa7f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 24 Sep 2016 20:13:28 -0400 Subject: [PATCH] basic/strv: add STRPTR_IN_SET Also some trivial tests for STR_IN_SET and STRPTR_IN_SET. --- src/basic/strv.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/basic/strv.h b/src/basic/strv.h index c4a8a1d20..0a908c893 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -160,6 +160,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 = ({ \ -- 2.30.2