From: Willy Tarreau Date: Tue, 19 Nov 2024 14:44:32 +0000 (+0100) Subject: MINOR: tools: add new macro DEFZERO to provide a default zero argument X-Git-Tag: v3.1-dev14~68 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e57581d76d86329646c4ff788f98c8cb9c03981b;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/haproxy/tools-t.h b/include/haproxy/tools-t.h index ad881ae8f0..34e2fd818f 100644 --- a/include/haproxy/tools-t.h +++ b/include/haproxy/tools-t.h @@ -51,6 +51,12 @@ * use in macros arguments. */ #define DEFNULL(...) _FIRST_ARG(NULL, ##__VA_ARGS__, NULL) + +/* DEFZERO() returns either the argument as-is, or 0 if absent. This is for + * use in macros arguments. + */ +#define DEFZERO(...) _FIRST_ARG(NULL, ##__VA_ARGS__, 0) + #define _FIRST_ARG(a, b, ...) b /* options flags for parse_line() */