summaryrefslogtreecommitdiff
path: root/common/spice_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/spice_common.h')
-rw-r--r--common/spice_common.h58
1 files changed, 8 insertions, 50 deletions
diff --git a/common/spice_common.h b/common/spice_common.h
index e9f5ff5..5572326 100644
--- a/common/spice_common.h
+++ b/common/spice_common.h
@@ -23,57 +23,15 @@
#include <time.h>
#include <stdlib.h>
#include <stddef.h>
-#include "backtrace.h"
-
-#define ASSERT(x) if (!(x)) { \
- printf("%s: ASSERT %s failed\n", __FUNCTION__, #x); \
- spice_backtrace(); \
- abort(); \
-}
-
-#define PANIC(format, ...) do { \
- printf("%s: panic: " format "\n", __FUNCTION__, ## __VA_ARGS__ ); \
- abort(); \
-} while (0)
-
-#define PANIC_ON(x) if ((x)) { \
- printf("%s: panic %s\n", __FUNCTION__, #x); \
- abort(); \
-}
-
-#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, ...) 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, ##__VA_ARGS__ );
-#define WARN_ONCE red_printf_once
-
-#define red_printf_some(every, format, ...) do { \
- static int count = 0; \
- if (count++ % (every) == 0) { \
- printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__ ); \
- } \
-} while (0)
+#include <spice/macros.h>
+#include "backtrace.h"
+#include "log.h"
-#define red_printf_debug(debug, prefix, format, ...) do { \
- static int debug_level = -1; \
- if (debug_level == -1) { \
- debug_level = getenv("SPICE_DEBUG_LEVEL") != NULL ? atoi(getenv("SPICE_DEBUG_LEVEL")) : 0; \
- } \
- if (debug <= debug_level) { \
- printf("%s: %s: " format "\n", prefix, __FUNCTION__, ## __VA_ARGS__ ); \
- } \
-} while(0)
+#ifdef SPICE_DISABLE_ABORT
+#define spice_abort() do { } while(0)
+#else
+#define spice_abort() abort()
+#endif
#endif