[Spice-devel] [PATCH 10/12] move WARN and WARN_ONCE to spice_common.h

Christophe Fergeau cfergeau at redhat.com
Fri Apr 22 09:43:08 PDT 2011


---
 common/glc.c          |    8 --------
 common/rop3.c         |    8 ++------
 common/spice_common.h |    2 ++
 3 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/common/glc.c b/common/glc.c
index 0396fc9..f85d9f6 100644
--- a/common/glc.c
+++ b/common/glc.c
@@ -40,14 +40,6 @@
 #include "glc.h"
 #include "gl_utils.h"
 
-#define WARN_ONCE(x) {      \
-    static int warn = TRUE; \
-    if (warn) {             \
-        printf x;           \
-        warn = FALSE;       \
-    }                       \
-}
-
 #define TESS_VERTEX_ALLOC_BUNCH 20
 
 typedef struct InternaCtx InternaCtx;
diff --git a/common/rop3.c b/common/rop3.c
index 1ce2cd2..af872c1 100644
--- a/common/rop3.c
+++ b/common/rop3.c
@@ -24,10 +24,6 @@
 #include "rop3.h"
 #include "spice_common.h"
 
-#ifndef WARN
-#define WARN(x) printf("warning: %s\n", x)
-#endif
-
 typedef void (*rop3_with_pattern_handler_t)(pixman_image_t *d, pixman_image_t *s,
                                             SpicePoint *src_pos, pixman_image_t *p,
                                             SpicePoint *pat_pos);
@@ -51,13 +47,13 @@ static void default_rop3_with_pattern_handler(pixman_image_t *d, pixman_image_t
                                               SpicePoint *src_pos, pixman_image_t *p,
                                               SpicePoint *pat_pos)
 {
-    WARN("not implemented 0x%x");
+    WARN("not implemented");
 }
 
 static void default_rop3_withe_color_handler(pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos,
                                              uint32_t rgb)
 {
-    WARN("not implemented 0x%x");
+    WARN("not implemented");
 }
 
 static void default_rop3_test_handler()
diff --git a/common/spice_common.h b/common/spice_common.h
index 430c8af..ed28689 100644
--- a/common/spice_common.h
+++ b/common/spice_common.h
@@ -53,6 +53,8 @@
         printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__ );  \
     }                                                               \
 }
+#define WARN(format, ...) red_printf("warning: "format"\n", ##__VA_ARGS__ );
+#define WARN_ONCE red_printf_once
 
 #define red_printf_some(every, format, ...) {                       \
     static int count = 0;                                           \
-- 
1.7.4.4



More information about the Spice-devel mailing list