Skip to content

Commit e57581d

Browse files
committed
MINOR: tools: add new macro DEFZERO to provide a default zero argument
This is the equivalent of DEFNULL except that it sets a zero value instead of a NULL for a missing argument.
1 parent c5052ba commit e57581d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

include/haproxy/tools-t.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@
5151
* use in macros arguments.
5252
*/
5353
#define DEFNULL(...) _FIRST_ARG(NULL, ##__VA_ARGS__, NULL)
54+
55+
/* DEFZERO() returns either the argument as-is, or 0 if absent. This is for
56+
* use in macros arguments.
57+
*/
58+
#define DEFZERO(...) _FIRST_ARG(NULL, ##__VA_ARGS__, 0)
59+
5460
#define _FIRST_ARG(a, b, ...) b
5561

5662
/* options flags for parse_line() */

0 commit comments

Comments
 (0)