[Spice-devel] [PATCHv2 10/12] move WARN and WARN_ONCE to spice_common.h
Christophe Fergeau
cfergeau at redhat.com
Wed Apr 27 00:40:12 PDT 2011
---
common/glc.c | 11 ++---------
common/ogl_ctx.c | 1 +
common/rop3.c | 8 ++------
common/spice_common.h | 2 ++
4 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/common/glc.c b/common/glc.c
index 0396fc9..1c81dd8 100644
--- a/common/glc.c
+++ b/common/glc.c
@@ -39,14 +39,7 @@
#include "mem.h"
#include "glc.h"
#include "gl_utils.h"
-
-#define WARN_ONCE(x) { \
- static int warn = TRUE; \
- if (warn) { \
- printf x; \
- warn = FALSE; \
- } \
-}
+#include "spice_common.h"
#define TESS_VERTEX_ALLOC_BUNCH 20
@@ -1015,7 +1008,7 @@ void _glc_fill_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, i
ASSERT(ctx && bitmap);
start_draw(ctx);
if (ctx->pat) {
- WARN_ONCE(("%s: unimplemented fill mask with pattern\n", __FUNCTION__));
+ WARN_ONCE("%s: unimplemented fill mask with pattern\n", __FUNCTION__);
}
fill_mask(ctx, x_dest, y_dest, width, height, stride, bitmap);
}
diff --git a/common/ogl_ctx.c b/common/ogl_ctx.c
index 76a3551..0917f42 100644
--- a/common/ogl_ctx.c
+++ b/common/ogl_ctx.c
@@ -25,6 +25,7 @@
#include <GL/glx.h>
#include "ogl_ctx.h"
+#include "spice_common.h"
enum {
OGLCTX_TYPE_PBUF,
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