Commit b541a21f authored by Daniel Salzman's avatar Daniel Salzman
Browse files

Unify WS in macros

parent c5e093bd
......@@ -57,8 +57,8 @@ static void test_int(const char *in, int expected, int errcode)
}
// mute warn_unused_result
#define asprintf(args, ...) do { \
int r = (asprintf)(args, ##__VA_ARGS__); assert(r >= 0); \
#define asprintf(args, ...) do { \
int r = (asprintf)(args, ##__VA_ARGS__); assert(r >= 0); \
} while (0);
int main(int argc, char *argv[])
......
......@@ -356,7 +356,7 @@ static int stream_skip(char **stream, size_t *maxlen, int nbytes)
}
/*! \brief Stream write with constraints checks. */
#define STREAM_WRITE(stream, maxlen, fn, args, ...) \
#define STREAM_WRITE(stream, maxlen, fn, args, ...) \
if (stream_skip(&(stream), (maxlen), fn(stream, *(maxlen), args, ##__VA_ARGS__)) != KNOT_EOK) { \
return KNOT_ESPACE; \
}
......
......@@ -209,7 +209,7 @@ int xfr_process_list(knot_pkt_t *pkt, xfr_put_cb process_item,
}
/* AXFR-specific logging (internal, expects 'qdata' variable set). */
#define AXFROUT_LOG(severity, msg, ...) \
#define AXFROUT_LOG(severity, msg, ...) \
QUERY_LOG(severity, qdata, "AXFR, outgoing", msg, ##__VA_ARGS__)
int axfr_query_process(knot_pkt_t *pkt, struct query_data *qdata)
......@@ -307,7 +307,7 @@ static int axfr_answer_init(struct answer_data *data)
}
/* AXFR-specific logging (internal, expects 'adata' variable set). */
#define AXFRIN_LOG(severity, msg, ...) \
#define AXFRIN_LOG(severity, msg, ...) \
ANSWER_LOG(severity, adata, "AXFR, incoming", msg, ##__VA_ARGS__)
static int axfr_answer_finalize(struct answer_data *adata)
......
......@@ -58,7 +58,7 @@ struct ixfr_proc {
};
/* IXFR-out-specific logging (internal, expects 'qdata' variable set). */
#define IXFROUT_LOG(severity, msg, ...) \
#define IXFROUT_LOG(severity, msg, ...) \
QUERY_LOG(severity, qdata, "IXFR, outgoing", msg, ##__VA_ARGS__)
/*! \brief Helper macro for putting RRs into packet. */
......@@ -331,7 +331,7 @@ static int ixfr_answer_soa(knot_pkt_t *pkt, struct query_data *qdata)
/* ------------------------- IXFR-in processing ----------------------------- */
/* IXFR-in-specific logging (internal, expects 'adata' variable set). */
#define IXFRIN_LOG(severity, msg, ...) \
#define IXFRIN_LOG(severity, msg, ...) \
ANSWER_LOG(severity, adata, "IXFR, incoming", msg, ##__VA_ARGS__)
/*! \brief Checks whether server responded with AXFR-style IXFR. */
......
......@@ -43,7 +43,7 @@
/*----------------------------------------------------------------------------*/
/* NOTIFY-specific logging (internal, expects 'qdata' variable set). */
#define NOTIFY_QLOG(severity, msg, ...) \
#define NOTIFY_QLOG(severity, msg, ...) \
QUERY_LOG(severity, qdata, "NOTIFY, incoming", msg, ##__VA_ARGS__)
static int notify_check_query(struct query_data *qdata)
......@@ -110,7 +110,7 @@ int notify_process_query(knot_pkt_t *pkt, struct query_data *qdata)
#undef NOTIFY_QLOG
/* NOTIFY-specific logging (internal, expects 'adata' variable set). */
#define NOTIFY_RLOG(severity, msg, ...) \
#define NOTIFY_RLOG(severity, msg, ...) \
ANSWER_LOG(severity, adata, "NOTIFY, outgoing", msg, ##__VA_ARGS__)
int notify_process_answer(knot_pkt_t *pkt, struct answer_data *adata)
......
......@@ -34,9 +34,9 @@ const knot_layer_api_t *process_answer_layer(void);
#define KNOT_STATE_ANSWER process_answer_layer()
/*! \brief Answer processing logging base. */
#define ANSWER_LOG(severity, data, operation, msg, ...) \
#define ANSWER_LOG(severity, data, operation, msg, ...) \
NS_PROC_LOG(severity, (data)->param->remote, (data)->param->zone->name, \
operation, msg, ##__VA_ARGS__);
operation, msg, ##__VA_ARGS__);
/*!
* \brief Processing module parameters.
......
......@@ -43,7 +43,7 @@ const knot_layer_api_t *process_query_layer(void);
} while (0)
/*! \brief Query logging common base. */
#define QUERY_LOG(severity, qdata, operation, msg, ...) \
#define QUERY_LOG(severity, qdata, operation, msg, ...) \
NS_PROC_LOG(severity, (qdata)->param->remote, knot_pkt_qname((qdata)->query), \
operation, msg, ##__VA_ARGS__);
......
......@@ -38,7 +38,7 @@
#include "libknot/processing/requestor.h"
/* UPDATE-specific logging (internal, expects 'qdata' variable set). */
#define UPDATE_LOG(severity, msg, ...) \
#define UPDATE_LOG(severity, msg, ...) \
QUERY_LOG(severity, qdata, "DDNS", msg, ##__VA_ARGS__)
static void init_qdata_from_request(struct query_data *qdata,
......
......@@ -46,7 +46,7 @@
/* ------------------------- zone query requesting -------------------------- */
/*! \brief Zone event logging. */
#define ZONE_QUERY_LOG(severity, zone, remote, operation, msg, ...) \
#define ZONE_QUERY_LOG(severity, zone, remote, operation, msg, ...) \
NS_PROC_LOG(severity, &(remote)->addr, zone->name, operation, msg, ##__VA_ARGS__)
/*! \brief Create zone query packet. */
......@@ -152,7 +152,7 @@ fail:
}
/* @note Module specific, expects some variables set. */
#define ZONE_XFER_LOG(severity, pkt_type, msg, ...) \
#define ZONE_XFER_LOG(severity, pkt_type, msg, ...) \
if (pkt_type == KNOT_QUERY_AXFR) { \
ZONE_QUERY_LOG(severity, zone, master, "AXFR, incoming", msg, ##__VA_ARGS__); \
} else { \
......
......@@ -26,9 +26,9 @@
{ \
uns m = (l+r)/2; \
if (ary_lt_x(ary, m, x, __VA_ARGS__)) \
l = m+1; \
l = m+1; \
else \
r = m; \
r = m; \
} \
l; \
})
......
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