From: Vladimír Čunát Date: Wed, 21 Nov 2018 16:58:01 +0000 (+0100) Subject: treewide: use more standard variadic macros X-Git-Tag: v3.2.0~25^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9e22ec1abea86cf8f1a464646888843b38dfd1b1;p=thirdparty%2Fknot-resolver.git treewide: use more standard variadic macros There's still an unresolved "problem" with QRVERBOSE getting empty variadic list sometimes, and I can't see a good way around that. --- diff --git a/contrib/ucw/lib.h b/contrib/ucw/lib.h index 771879330..506f09b56 100644 --- a/contrib/ucw/lib.h +++ b/contrib/ucw/lib.h @@ -118,7 +118,7 @@ * === Basic logging functions (see <> and for more) ***/ -#define DBG(x,y...) do { } while(0) +#define DBG(x, ...) do { } while(0) #define DBG_SPOT do { } while(0) #define ASSERT(x) diff --git a/daemon/tls.c b/daemon/tls.c index 3ffbb1595..5182507e3 100644 --- a/daemon/tls.c +++ b/daemon/tls.c @@ -41,9 +41,9 @@ /** @internal Debugging facility. */ #ifdef DEBUG -#define DEBUG_MSG(fmt...) kr_log_verbose("[tls] " fmt) +#define DEBUG_MSG(...) kr_log_verbose("[tls] " __VA_ARGS__) #else -#define DEBUG_MSG(fmt...) +#define DEBUG_MSG(...) #endif struct async_write_ctx { diff --git a/daemon/worker.c b/daemon/worker.c index d39e06105..ce52a50a8 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -54,7 +54,7 @@ #define MAX_PIPELINED 100 #endif -#define VERBOSE_MSG(qry, fmt...) QRVERBOSE(qry, "wrkr", fmt) +#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, "wrkr", __VA_ARGS__) /** Client request state. */ struct request_ctx diff --git a/daemon/zimport.c b/daemon/zimport.c index 6cf81266a..b20c11fbe 100644 --- a/daemon/zimport.c +++ b/daemon/zimport.c @@ -58,7 +58,7 @@ #include "lib/generic/map.h" #include "lib/generic/array.h" -#define VERBOSE_MSG(qry, fmt...) QRVERBOSE(qry, "zimport", fmt) +#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, "zimport", __VA_ARGS__) /* Pause between parse and import stages, milliseconds. * See comment in zi_zone_import() */ diff --git a/lib/cache/impl.h b/lib/cache/impl.h index c56cb35df..a08f35536 100644 --- a/lib/cache/impl.h +++ b/lib/cache/impl.h @@ -391,7 +391,7 @@ int nsec3_src_synth(struct key *k, struct answer *ans, const knot_dname_t *clenc -#define VERBOSE_MSG(qry, fmt...) QRVERBOSE((qry), "cach", fmt) +#define VERBOSE_MSG(qry, ...) QRVERBOSE((qry), "cach", ## __VA_ARGS__) /** Shorthand for operations on cache backend */ #define cache_op(cache, op, ...) (cache)->api->op((cache)->db, ## __VA_ARGS__) diff --git a/lib/layer/iterate.c b/lib/layer/iterate.c index 33152a2ec..0c4e2a3c3 100644 --- a/lib/layer/iterate.c +++ b/lib/layer/iterate.c @@ -44,8 +44,8 @@ #include "lib/module.h" #include "lib/dnssec/ta.h" -#define VERBOSE_MSG(fmt...) QRVERBOSE(req->current_query, "iter", fmt) -#define QVERBOSE_MSG(qry, fmt...) QRVERBOSE(qry, "iter", fmt) +#define VERBOSE_MSG(...) QRVERBOSE(req->current_query, "iter", __VA_ARGS__) +#define QVERBOSE_MSG(qry, ...) QRVERBOSE(qry, "iter", __VA_ARGS__) /* Iterator often walks through packet section, this is an abstraction. */ typedef int (*rr_callback_t)(const knot_rrset_t *, unsigned, struct kr_request *); diff --git a/lib/layer/validate.c b/lib/layer/validate.c index 6ff2febce..adfea0fab 100644 --- a/lib/layer/validate.c +++ b/lib/layer/validate.c @@ -36,7 +36,7 @@ #include "lib/defines.h" #include "lib/module.h" -#define VERBOSE_MSG(qry, fmt...) QRVERBOSE(qry, "vldr", fmt) +#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, "vldr", __VA_ARGS__) #define MAX_REVALIDATION_CNT 2 diff --git a/lib/resolve.c b/lib/resolve.c index bce29c9af..dfb880ba8 100644 --- a/lib/resolve.c +++ b/lib/resolve.c @@ -37,7 +37,7 @@ #define KNOT_EDNS_OPTION_COOKIE 10 #endif /* defined(ENABLE_COOKIES) */ -#define VERBOSE_MSG(qry, fmt...) QRVERBOSE((qry), "resl", fmt) +#define VERBOSE_MSG(qry, ...) QRVERBOSE((qry), "resl", __VA_ARGS__) bool kr_rank_check(uint8_t rank) { diff --git a/lib/rplan.c b/lib/rplan.c index 8c07a0d01..d9127f593 100644 --- a/lib/rplan.c +++ b/lib/rplan.c @@ -23,7 +23,7 @@ #include "lib/defines.h" #include "lib/layer.h" -#define VERBOSE_MSG(qry, fmt...) QRVERBOSE(qry, "plan", fmt) +#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, "plan", __VA_ARGS__) #define QUERY_PROVIDES(q, name, cls, type) \ ((q)->sclass == (cls) && (q)->stype == type && knot_dname_is_equal((q)->sname, name)) diff --git a/lib/utils.h b/lib/utils.h index 9526f88bf..22f02d14d 100644 --- a/lib/utils.h +++ b/lib/utils.h @@ -42,8 +42,8 @@ typedef void (*trace_callback_f)(struct kr_request *request); /** @brief Callback for request logging handler. */ typedef void (*trace_log_f)(const struct kr_query *query, const char *source, const char *msg); -#define kr_log_info(fmt, ...) do { printf((fmt), ## __VA_ARGS__); fflush(stdout); } while(0) -#define kr_log_error(fmt, ...) fprintf(stderr, (fmt), ## __VA_ARGS__) +#define kr_log_info(...) do { printf(__VA_ARGS__); fflush(stdout); } while(0) +#define kr_log_error(...) fprintf(stderr, ## __VA_ARGS__) /* Always export these, but override direct calls by macros conditionally. */ /** Whether in --verbose mode. Only use this for reading. */ diff --git a/lib/zonecut.c b/lib/zonecut.c index c785d2ebc..0148ae91b 100644 --- a/lib/zonecut.c +++ b/lib/zonecut.c @@ -27,7 +27,7 @@ #include #include -#define VERBOSE_MSG(qry, fmt...) QRVERBOSE(qry, "zcut", fmt) +#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, "zcut", __VA_ARGS__) /** Information for one NS name + address type. */ typedef enum { diff --git a/modules/cookies/cookiemonster.c b/modules/cookies/cookiemonster.c index 164b15300..42e4788f9 100644 --- a/modules/cookies/cookiemonster.c +++ b/modules/cookies/cookiemonster.c @@ -33,7 +33,7 @@ #include "lib/rplan.h" #include "modules/cookies/cookiemonster.h" -#define VERBOSE_MSG(qry, fmt...) QRVERBOSE(qry, "cookies", fmt) +#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, "cookies", __VA_ARGS__) /** * Obtain address from query/response context if if can be obtained. diff --git a/modules/hints/hints.c b/modules/hints/hints.c index 45cf4ae8d..1edfcd719 100644 --- a/modules/hints/hints.c +++ b/modules/hints/hints.c @@ -34,8 +34,8 @@ #include "lib/layer.h" /* Defaults */ -#define VERBOSE_MSG(qry, fmt...) QRVERBOSE(qry, "hint", fmt) -#define ERR_MSG(fmt, ...) kr_log_error("[ ][hint] " fmt, ## __VA_ARGS__) +#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, "hint", __VA_ARGS__) +#define ERR_MSG(...) kr_log_error("[ ][hint] " __VA_ARGS__) struct hints_data { struct kr_zonecut hints; diff --git a/modules/stats/stats.c b/modules/stats/stats.c index 8e968a82f..6a54f999d 100644 --- a/modules/stats/stats.c +++ b/modules/stats/stats.c @@ -40,7 +40,7 @@ #endif /* Defaults */ -#define VERBOSE_MSG(qry, fmt...) QRVERBOSE(qry, "stat", fmt) +#define VERBOSE_MSG(qry, ...) QRVERBOSE(qry, "stat", __VA_ARGS__) #define FREQUENT_PSAMPLE 10 /* Sampling rate, 1 in N */ #ifdef LRU_REP_SIZE #define FREQUENT_COUNT LRU_REP_SIZE /* Size of frequent tables */