]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
treewide: use more standard variadic macros
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 21 Nov 2018 16:58:01 +0000 (17:58 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 26 Nov 2018 14:18:23 +0000 (15:18 +0100)
There's still an unresolved "problem" with QRVERBOSE getting
empty variadic list sometimes, and I can't see a good way around that.

14 files changed:
contrib/ucw/lib.h
daemon/tls.c
daemon/worker.c
daemon/zimport.c
lib/cache/impl.h
lib/layer/iterate.c
lib/layer/validate.c
lib/resolve.c
lib/rplan.c
lib/utils.h
lib/zonecut.c
modules/cookies/cookiemonster.c
modules/hints/hints.c
modules/stats/stats.c

index 771879330c6c35b38310e0861136398017679f1a..506f09b56b5a6ed593e9c63d728dd8e7cfc2f2b6 100644 (file)
  * === Basic logging functions (see <<log:,Logging>> and <ucw/log.h> for more)
  ***/
 
-#define DBG(x,y...) do { } while(0)
+#define DBG(x, ...) do { } while(0)
 #define DBG_SPOT do { } while(0)
 #define ASSERT(x)
 
index 3ffbb1595d954aadefc0b320d663efda52e2118c..5182507e3a4ca749046c851544057ef07a1bb919 100644 (file)
@@ -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 {
index d39e06105745962a6067773cfe8987c3dc2a8a4f..ce52a50a8fe26afa198772937feb509137670b02 100644 (file)
@@ -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
index 6cf81266a7174052b4e96c9602f8835f17705f89..b20c11fbe764d42ff9dab9d371393972ad83fd7f 100644 (file)
@@ -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() */
index c56cb35df1039521aa6ec8aa170f00eeedd0a7ac..a08f3553602df068c2d5265771659c6f98527607 100644 (file)
@@ -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__)
index 33152a2eca91c548223dfc1b64fb06b8088f42c6..0c4e2a3c35e193d7efc14c540c8f50cb2b6635d5 100644 (file)
@@ -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 *);
index 6ff2febced8e5ee9d40f03765566a8c2d7997ad7..adfea0fabb4b2569a9dcd395ddeea763a28d536a 100644 (file)
@@ -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
 
index bce29c9afb3537df95ba72be16b8291ca593253f..dfb880ba8925b04953b7a1afd0838faa66ef08b1 100644 (file)
@@ -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)
 {
index 8c07a0d01a13cd98596c8cd3359b6b5ea2ebca4e..d9127f59362959ff5ca7610a5b09742d29965f5d 100644 (file)
@@ -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))
 
index 9526f88bf33ea228771f019ce1fe224225d79fcf..22f02d14d623f350e23cac41b65201549aa62490 100644 (file)
@@ -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. */
index c785d2ebcd6f68b5db02cd85e71a85bad6324558..0148ae91b25ecad1bb79d9cce77d5835da5cec51 100644 (file)
@@ -27,7 +27,7 @@
 #include <libknot/packet/wire.h>
 #include <libknot/rrtype/rdname.h>
 
-#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 {
index 164b15300fd43befcf378a95780ca7d1985e00d7..42e4788f9c83af441578243a37282a7a86d0d227 100644 (file)
@@ -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.
index 45cf4ae8d871792979fe3d5076c69c5b5c1e2b0f..1edfcd71941c08a61fd69335df4809bee07a1ae2 100644 (file)
@@ -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;
index 8e968a82f1139deba8905496066d8f80aad20d32..6a54f999dc6258a5f4a921001ca480bda2270c2a 100644 (file)
@@ -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 */