summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2011-07-23 13:11:54 +0300
committerAlon Levy <alevy@redhat.com>2011-07-23 13:13:26 +0300
commit432c5870104f583166234b9655628f359983bbfa (patch)
treea4b30eb5aed160305f1a57efa3e170376c1cc181
parent345c0b9818d5624858cfeb6b9ddba92d4eb64a0d (diff)
spiceqxl_io_port: make dprint silent
and read XSPICE_IO_PORT_DEBUG_LEVEL environment variable.
-rw-r--r--src/spiceqxl_io_port.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/spiceqxl_io_port.c b/src/spiceqxl_io_port.c
index 3968d5f..386cab7 100644
--- a/src/spiceqxl_io_port.c
+++ b/src/spiceqxl_io_port.c
@@ -52,14 +52,25 @@
ret = &m_item->el; \
}
-static int spiceqxl_io_port_debug_level = 5;
+static int spiceqxl_io_port_debug_level = -1;
-#define dprint(_level, _fmt, ...) \
- do { \
- if (spiceqxl_io_port_debug_level >= _level) { \
- fprintf(stderr, _fmt, ## __VA_ARGS__); \
- } \
- } while (0)
+static void dprint(int _level, const char *_fmt, ...)
+{
+ if (spiceqxl_io_port_debug_level == -1) {
+ if (getenv("XSPICE_IO_PORT_DEBUG_LEVEL")) {
+ spiceqxl_io_port_debug_level = atoi(
+ getenv("XSPICE_IO_PORT_DEBUG_LEVEL"));
+ } else {
+ spiceqxl_io_port_debug_level = 0;
+ }
+ }
+ if (spiceqxl_io_port_debug_level >= _level) {
+ va_list ap;
+ va_start(ap, _fmt);
+ vfprintf(stderr, _fmt, ap);
+ va_end(ap);
+ }
+}
void xspice_init_qxl_ram(qxl_screen_t *qxl)
{