]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib: option to turn off debugging
authorMarek Vavruša <marek.vavrusa@nic.cz>
Wed, 28 Jan 2015 17:44:54 +0000 (18:44 +0100)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Wed, 28 Jan 2015 17:45:28 +0000 (18:45 +0100)
lib/cache.c
lib/layer/iterate.c
lib/layer/itercache.c
lib/layer/stats.c
lib/resolve.c
lib/rplan.c
lib/zonecut.c

index 8a3014e204e157e19f3ce51eba94252d5c08ffa4..85b32a41d660a6c50d97b047774659de81d6b585 100644 (file)
 #include "lib/cache.h"
 #include "lib/defines.h"
 
+#ifndef NDEBUG
 #define DEBUG_MSG(fmt, ...) fprintf(stderr, "[cache] " fmt, ## __VA_ARGS__)
+#else
+#define DEBUG_MSG(fmt, ...)
+#endif
+
 #define db_api namedb_lmdb_api()
 
 namedb_t *kr_cache_open(const char *handle, mm_ctx_t *mm, size_t maxsize)
index 5e1027bc40c4d2c5fed6b6e8252b707d54886d07..b0acb11613836f912981b665fa57cd59849657a6 100644 (file)
 #include "lib/rplan.h"
 #include "lib/utils.h"
 
+#ifndef NDEBUG
 #define DEBUG_MSG(fmt, ...) fprintf(stderr, "[qiter] " fmt, ## __VA_ARGS__)
+#else
+#define DEBUG_MSG(fmt, ...)
+#endif
 
 /* Iterator often walks through packet section, this is an abstraction. */
 typedef int (*rr_callback_t)(const knot_rrset_t *, struct kr_layer_param *);
index ff990429b17b7907df6034e050ae4abd7f97165c..228e3595e6d272febb2a82279e0cbff72b98cdd0 100644 (file)
 #include "lib/layer/iterate.h"
 #include "lib/utils.h"
 
+#ifndef NDEBUG
 #define DEBUG_MSG(fmt, ...) fprintf(stderr, "[cache] " fmt, ## __VA_ARGS__)
+#else
+#define DEBUG_MSG(fmt, ...)
+#endif
 
 typedef int (*rr_callback_t)(const knot_rrset_t *, unsigned, struct kr_layer_param *);
 
index ccd171c57b351af087dbbaad494079c4ad8931e0..bb25b22812a3f39cc813294e4fd59b1f912280ba 100644 (file)
 #include "lib/layer/stats.h"
 #include "lib/rplan.h"
 
+#ifndef NDEBUG
 #define DEBUG_MSG(fmt, ...) fprintf(stderr, "[stats] " fmt, ## __VA_ARGS__)
+#else
+#define DEBUG_MSG(fmt, ...)
+#endif
 
 //static void update_stats(struct kr_ns *ns, double rtt)
 //{
@@ -38,11 +42,11 @@ static int begin(knot_layer_t *ctx, void *param)
 
 static int finish(knot_layer_t *ctx)
 {
+#ifndef NDEBUG
        struct kr_layer_param *param = ctx->data;
        struct kr_rplan *rplan = param->rplan;
        const knot_pkt_t *answer = param->answer;
 
-#ifndef NDEBUG
        /* Calculate total RTT and number of queries. */
        double total_rtt = 0.0;
        size_t nr_queries = list_size(&rplan->resolved);
index 4e415497b809cb6e5cd214c18e684cc40ca317ef..c94288dac124e74e67ee28d4f550469cde161ffa 100755 (executable)
 #include "lib/layer/static.h"
 #include "lib/layer/stats.h"
 
+#ifndef NDEBUG
 #define DEBUG_MSG(fmt, ...) fprintf(stderr, "[reslv] " fmt, ## __VA_ARGS__)
+#else
+#define DEBUG_MSG(fmt, ...)
+#endif
 
 /* Defines */
 #define ITER_LIMIT 50
index f8a493d900dc5933196a55e3399190b90ea926c3..4b4e76a9fe4083bee982d726f336b6b2bc7ed143 100644 (file)
 #include "lib/cache.h"
 #include "lib/utils.h"
 
+#ifndef NDEBUG
 #define DEBUG_MSG(fmt, ...) fprintf(stderr, "[rplan] " fmt, ## __VA_ARGS__)
+#else
+#define DEBUG_MSG(fmt, ...)
+#endif
 
 static struct kr_query *query_create(mm_ctx_t *pool, const knot_dname_t *name)
 {
index fb7620255438dae8818dcd11dd2d2d83deb6b01c..a2345b3457a89dc608ef009b2ebe3c9e3f35512b 100644 (file)
 #include "lib/utils.h"
 #include "lib/rplan.h"
 
+#ifndef NDEBUG
 #define DEBUG_MSG(fmt, ...) fprintf(stderr, "[z-cut] " fmt, ## __VA_ARGS__)
+#else
+#define DEBUG_MSG(fmt, ...)
+#endif
 
 /* \brief Root hint descriptor. */
 struct hint_info {