qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 24/43] migration: made printf always compile in debug output
@ 2017-04-01 13:58 Danil Antonov
  2017-04-03  6:35 ` Juan Quintela
  0 siblings, 1 reply; 2+ messages in thread
From: Danil Antonov @ 2017-04-01 13:58 UTC (permalink / raw)
  To: qemu-devel, quintela

>From e5719e802fcd1d1b426d687524ed46f10d044941 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.anto@gmail.com>
Date: Wed, 29 Mar 2017 12:35:10 +0300
Subject: [PATCH 24/43] migration: 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 <g.danil.anto@gmail.com>
---
 migration/block.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/migration/block.c b/migration/block.c
index 7734ff7..a5b4e49 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -42,13 +42,15 @@

 //#define DEBUG_BLK_MIGRATION

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

 typedef struct BlkMigDevState {
     /* Written during setup phase.  Can be read without a lock.  */
-- 
2.8.0.rc3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-03  6:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-01 13:58 [Qemu-devel] [PATCH 24/43] migration: made printf always compile in debug output Danil Antonov
2017-04-03  6:35 ` Juan Quintela

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).