qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 05/43] xen-mapcache: made printf always compile in d


From: Danil Antonov
Subject: [Qemu-devel] [PATCH 05/43] xen-mapcache: made printf always compile in debug
Date: Sat, 1 Apr 2017 16:35:51 +0300

>From 0e4a8a20c9c05e547d42be1b9ef868d12e7b43a9 Mon Sep 17 00:00:00 2001
From: Danil Antonov <address@hidden>
Date: Wed, 29 Mar 2017 02:14:06 +0300
Subject: [PATCH 05/43] xen-mapcache: made printf always compile in debug
 output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <address@hidden>
---
 xen-mapcache.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen-mapcache.c b/xen-mapcache.c
index 1a96d2e..c2d1e6f 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -22,15 +22,15 @@
 #include "trace-root.h"


-//#define MAPCACHE_DEBUG
-
-#ifdef MAPCACHE_DEBUG
-#  define DPRINTF(fmt, ...) do { \
-    fprintf(stderr, "xen_mapcache: " fmt, ## __VA_ARGS__); \
-} while (0)
-#else
-#  define DPRINTF(fmt, ...) do { } while (0)
-#endif
+#ifndef MAPCACHE_DEBUG
+#define MAPCACHE_DEBUG 0
+#endif
+
+#define DPRINTF(fmt, ...) do {                                 \
+    if (MAPCACHE_DEBUG) {                                      \
+        fprintf(stderr, "xen_mapcache: " fmt, ## __VA_ARGS__); \
+    }                                                          \
+} while (0);

 #if HOST_LONG_BITS == 32
 #  define MCACHE_BUCKET_SHIFT 16
-- 
2.8.0.rc3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]