Commit 9e22ec1a authored by Vladimír Čunát's avatar Vladimír Čunát

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.
parent 58def8bb
......@@ -118,7 +118,7 @@
* === 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)
......
......@@ -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 {
......
......@@ -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
......
......@@ -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() */
......
......@@ -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__)
......
......@@ -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 *);
......
......@@ -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
......
......@@ -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)
{
......
......@@ -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))
......
......@@ -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. */
......
......@@ -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 {
......
......@@ -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.
......
......@@ -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;
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment