summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2011-04-22 16:41:28 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2011-05-03 14:44:12 +0200
commit54f028a01d691c4b13c46a77c2ad33b03419f8b1 (patch)
tree9eb35650516ddb5fe2dd593c254f3892f867da22 /common
parent2a611d9955546dc52be37651e6f7b6f7f03c7aa4 (diff)
downloadspice-54f028a01d691c4b13c46a77c2ad33b03419f8b1.tar.gz
spice-54f028a01d691c4b13c46a77c2ad33b03419f8b1.tar.xz
spice-54f028a01d691c4b13c46a77c2ad33b03419f8b1.zip
use standard do { } while (0) for spice_common.h macros
Diffstat (limited to 'common')
-rw-r--r--common/spice_common.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/common/spice_common.h b/common/spice_common.h
index ed286892..d324ca18 100644
--- a/common/spice_common.h
+++ b/common/spice_common.h
@@ -28,40 +28,40 @@
abort(); \
}
-#define PANIC(format, ...) { \
+#define PANIC(format, ...) do { \
printf("%s: panic: " format "\n", __FUNCTION__, ## __VA_ARGS__ ); \
- abort(); \
-}
+ abort(); \
+} while (0)
-#define PANIC_ON(x) if ((x)) { \
+#define PANIC_ON(x) if ((x)) { \
printf("%s: panic %s\n", __FUNCTION__, #x); \
abort(); \
}
-#define red_error(format, ...) { \
+#define red_error(format, ...) do { \
printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__ ); \
abort(); \
-}
-
+} while (0)
#define red_printf(format, ...) \
printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__ )
-#define red_printf_once(format, ...) { \
+#define red_printf_once(format, ...) do { \
static int do_print = TRUE; \
if (do_print) { \
do_print = FALSE; \
printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__ ); \
} \
-}
+} while (0)
+
#define WARN(format, ...) red_printf("warning: "format"\n", ##__VA_ARGS__ );
#define WARN_ONCE red_printf_once
-#define red_printf_some(every, format, ...) { \
+#define red_printf_some(every, format, ...) do { \
static int count = 0; \
if (count++ % (every) == 0) { \
printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__ ); \
} \
-}
+} while (0)
static inline uint64_t get_time_stamp(void)
{