[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 24/43] migration: made printf always compile in debu
From: |
Danil Antonov |
Subject: |
[Qemu-devel] [PATCH 24/43] migration: made printf always compile in debug output |
Date: |
Sat, 1 Apr 2017 16:58:55 +0300 |
>From e5719e802fcd1d1b426d687524ed46f10d044941 Mon Sep 17 00:00:00 2001
From: Danil Antonov <address@hidden>
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 <address@hidden>
---
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
- [Qemu-devel] [PATCH 24/43] migration: made printf always compile in debug output,
Danil Antonov <=