summaryrefslogtreecommitdiff
path: root/include/nm-utils-internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/nm-utils-internal.h')
-rw-r--r--include/nm-utils-internal.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/nm-utils-internal.h b/include/nm-utils-internal.h
index 4f5850aace..69ab8391be 100644
--- a/include/nm-utils-internal.h
+++ b/include/nm-utils-internal.h
@@ -82,4 +82,19 @@
/********************************************************/
+#define NM_IN_SET(x, y, ...) \
+ ({ \
+ const typeof(y) _y = (y); \
+ typeof(_y) _x = (x); \
+ unsigned _i; \
+ gboolean _found = FALSE; \
+ for (_i = 0; _i < 1 + sizeof((typeof(_x)[]) { __VA_ARGS__ })/sizeof(typeof(_x)); _i++) { \
+ if (((typeof(_x)[]) { _y, __VA_ARGS__ })[_i] == _x) { \
+ _found = TRUE; \
+ break; \
+ } \
+ } \
+ _found; \
+ })
+
#endif