summaryrefslogtreecommitdiffstats
path: root/include/utils.h
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2010-02-18 03:56:15 +0100
committerPatrick McHardy <kaber@trash.net>2010-02-18 03:56:15 +0100
commit0d301955cf8c662cc5a9ea31977e14331acb8414 (patch)
tree941750d67af733e6b73b6b398329e1c6917ab3a4 /include/utils.h
parent8468ade3a36201b04a8da72018cee4bd8bf3efa8 (diff)
debug: allow to disable debugging code
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include/utils.h')
-rw-r--r--include/utils.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/utils.h b/include/utils.h
index 50da9bd..49dce87 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -18,8 +18,16 @@
#define __aligned(x) __attribute__((aligned(x)))
#define __packed __attribute__((packed))
-extern void dect_debug(const char *fmt, ...) __fmtstring(1, 2);
-extern void dect_hexdump(const char *prefix, const uint8_t *buf, size_t size);
+extern void __dect_debug(const char *fmt, ...) __fmtstring(1, 2);
+extern void __dect_hexdump(const char *prefix, const uint8_t *buf, size_t size);
+
+#ifdef DEBUG
+#define dect_debug(fmt, ...) __dect_debug(fmt, ## __VA_ARGS__)
+#define dect_hexdump(pfx, buf, size) __dect_hexdump(pfx, buf, size)
+#else
+#define dect_debug(fmt, ...) ({ if (0) __dect_debug(fmt, ## __VA_ARGS__); })
+#define dect_hexdump(pfx, buf, size) ({ if (0) __dect_hexdump(pfx, buf, size); })
+#endif
struct dect_trans_tbl {
uint64_t val;