mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-23 10:30:24 +01:00
std-aux: add NM_VA_ARGS_JOIN() helper macro
We have variadic macros like NM_UTILS_ENUM2STR() that create a switch statement. Their implementation relies on the way how __VA_ARGS__ gets expanded to a comma separated list. But that implementation is not great. Let's instead add (and later use) NM_VA_ARGS_JOIN() which can join variadic arguments by a configurable separator.
This commit is contained in:
parent
dadaba9ab6
commit
34a521e2d6
1 changed files with 4 additions and 0 deletions
|
|
@ -618,6 +618,10 @@ nm_streq0(const char *s1, const char *s2)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_VA_ARGS_JOIN(sep, ...) NM_VA_ARGS_FOREACH(, , sep, _NM_MACRO_SELECT_FIRST, __VA_ARGS__)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _NM_IN_SET_EVAL_1(op, _x, y) (_x == (y))
|
||||
#define _NM_IN_SET_EVAL_2(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_1(op, _x, __VA_ARGS__)
|
||||
#define _NM_IN_SET_EVAL_3(op, _x, y, ...) (_x == (y)) op _NM_IN_SET_EVAL_2(op, _x, __VA_ARGS__)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue