diff options
author | Thomas Haller <thaller@redhat.com> | 2020-07-30 19:14:24 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-08-05 10:22:10 +0200 |
commit | 3b64d88a935718ae9813641bbac440fc8eb34441 (patch) | |
tree | be30c5ebf8cab5f95b5b9b53ff7b927f30899fb0 /shared/nm-glib-aux/nm-macros-internal.h | |
parent | b16b42266d9964e63f3caaac788f06e323dc4c20 (diff) | |
download | NetworkManager-3b64d88a935718ae9813641bbac440fc8eb34441.tar.gz |
shared: add NM_IN_STRSET_ASCII_CASE() macro
Diffstat (limited to 'shared/nm-glib-aux/nm-macros-internal.h')
-rw-r--r-- | shared/nm-glib-aux/nm-macros-internal.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h index 551cd92f16..c9862be423 100644 --- a/shared/nm-glib-aux/nm-macros-internal.h +++ b/shared/nm-glib-aux/nm-macros-internal.h @@ -1233,6 +1233,16 @@ nm_strcmp_p (gconstpointer a, gconstpointer b) /*****************************************************************************/ +static inline int +_NM_IN_STRSET_ASCII_CASE_op_streq (const char *x, const char *s) +{ + return s && g_ascii_strcasecmp (x, s) == 0; +} + +#define NM_IN_STRSET_ASCII_CASE(x, ...) _NM_IN_STRSET_EVAL_N(||, _NM_IN_STRSET_ASCII_CASE_op_streq, x, NM_NARG (__VA_ARGS__), __VA_ARGS__) + +/*****************************************************************************/ + #define nm_g_slice_free(ptr) \ g_slice_free (typeof (*(ptr)), ptr) |