mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 14:21:00 +01:00
MINOR: tools: add a DEFNULL() macro to use NULL for empty args
It's sometimes convenient for debugging macros not to be forced to explicitly pass NULL in an unused argument. This macro does this, it replaces a missing arg with NULL.
This commit is contained in:
parent
9bead8c7f5
commit
32c24552e4
@ -61,6 +61,12 @@
|
||||
* power of 2, and 0 otherwise */
|
||||
#define POWEROF2(x) (((x) & ((x)-1)) == 0)
|
||||
|
||||
/* DEFNULL() returns either the argument as-is, or NULL if absent. This is for
|
||||
* use in macros arguments.
|
||||
*/
|
||||
#define DEFNULL(...) _FIRST_ARG(NULL, ##__VA_ARGS__, NULL)
|
||||
#define _FIRST_ARG(a, b, ...) b
|
||||
|
||||
/* operators to compare values. They're ordered that way so that the lowest bit
|
||||
* serves as a negation for the test and contains all tests that are not equal.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user