diff mbox

[11/14] slirp: Convert conditional compilation of debug printfs to regular ifs

Message ID 1398673575-7773-11-git-send-email-marc.mari.barcelo@gmail.com
State New
Headers show

Commit Message

Marc Marí April 28, 2014, 8:26 a.m. UTC
From: Marc Marí <5.markmb.5@gmail.com>

Modify debug macros as explained in https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg03642.html

Signed-off-by: Marc Marí <5.markmb.5@gmail.com>
---
 slirp/bootp.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/slirp/bootp.c b/slirp/bootp.c
index b7db9fa..9700bda 100644
--- a/slirp/bootp.c
+++ b/slirp/bootp.c
@@ -29,13 +29,18 @@ 
 
 static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE };
 
-#ifdef DEBUG
-#define DPRINTF(fmt, ...) \
-do if (slirp_debug & DBG_CALL) { fprintf(dfd, fmt, ##  __VA_ARGS__); fflush(dfd); } while (0)
-#else
-#define DPRINTF(fmt, ...) do{}while(0)
+#ifndef DEBUG
+#define DEBUG 0
 #endif
 
+#define DPRINTF(fmt, ...) \
+    do { \
+        if (DEBUG && (slirp_debug & DBG_CALL)) { \
+            fprintf(dfd, fmt, ##  __VA_ARGS__); \
+            fflush(dfd); \
+        } \
+    } while (0)
+
 static BOOTPClient *get_new_addr(Slirp *slirp, struct in_addr *paddr,
                                  const uint8_t *macaddr)
 {