From 31ebc6fc3542116295aeddf73b8269fe27bdb539 Mon Sep 17 00:00:00 2001
From: Johannes Schriewer <hallo@dunkelstern.de>
Date: Sat, 28 Jul 2018 02:40:48 +0200
Subject: [PATCH] Disable debugging functionality if DEBUG flag is not set

---
 .vscode/settings.json | 3 ++-
 src/debug.c           | 4 ++++
 src/debug.h           | 9 +++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/.vscode/settings.json b/.vscode/settings.json
index 97a143c..0d36bd5 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -12,6 +12,7 @@
         "system_error": "c",
         "array": "c",
         "string_view": "c",
-        "packet.h": "c"
+        "packet.h": "c",
+        "debug.h": "c"
     }
 }
diff --git a/src/debug.c b/src/debug.c
index 85ce8e7..94501fa 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -1,3 +1,5 @@
+#if DEBUG
+
 #include "stdio.h"
 
 #include "debug.h"
@@ -28,3 +30,5 @@ void hexdump(char *data, size_t len) {
         i += 16;
     }
 }
+
+#endif /* DEBUG */
diff --git a/src/debug.h b/src/debug.h
index c6a0e68..2088c6b 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -3,6 +3,15 @@
 
 #include <stdlib.h>
 
+#if DEBUG
+
 void hexdump(char *data, size_t len);
 
+#else /* DEBUG */
+
+#define hexdump(_data, _len) /* */
+
+#endif /* DEBUG */
+
+
 #endif /* debug_h__included */