From 6443643c1d3658d03a0dfc39168aa3417e0902ab Mon Sep 17 00:00:00 2001 From: Johannes Schriewer Date: Sat, 28 Jul 2018 22:34:49 +0200 Subject: [PATCH] Add DEBUG_LOG macro --- src/debug.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/debug.h b/src/debug.h index 8a8a478..edbb7bb 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1,11 +1,13 @@ #ifndef debug_h__included #define debug_h__included +#if DEBUG + #include #include #include -#if DEBUG +#define DEBUG_LOG(fmt, ...) fprintf(stderr, fmt "\n", ## __VA_ARGS__); static inline void hexdump(char *data, size_t len, int indent) { for (int i = 0; i < len;) { @@ -48,6 +50,7 @@ static inline void hexdump(char *data, size_t len, int indent) { #else /* DEBUG */ +#define DEBUG_LOG(fmt, ...) /* */ #define hexdump(_data, _len) /* */ #endif /* DEBUG */