vdi: Avoid bitrot of debugging code

Rework the debug define so that we always get -Wformat checking,
even when debugging is disabled.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Eric Blake 2018-02-13 14:26:56 -06:00 committed by Kevin Wolf
parent 47943e9865
commit b80666bf84
1 changed files with 9 additions and 3 deletions

View File

@ -87,12 +87,18 @@
#define DEFAULT_CLUSTER_SIZE (1 * MiB)
#if defined(CONFIG_VDI_DEBUG)
#define logout(fmt, ...) \
fprintf(stderr, "vdi\t%-24s" fmt, __func__, ##__VA_ARGS__)
#define VDI_DEBUG 1
#else
#define logout(fmt, ...) ((void)0)
#define VDI_DEBUG 0
#endif
#define logout(fmt, ...) \
do { \
if (VDI_DEBUG) { \
fprintf(stderr, "vdi\t%-24s" fmt, __func__, ##__VA_ARGS__); \
} \
} while (0)
/* Image signature. */
#define VDI_SIGNATURE 0xbeda107f