[Spice-devel] [PATCH qxl-wddm-dod 8/8] Make DebugPrintFuncSerial static

Frediano Ziglio fziglio at redhat.com
Wed Sep 28 13:55:47 UTC 2016


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 qxldod/driver.cpp | 12 ++++++++----
 qxldod/driver.h   | 13 +++----------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/qxldod/driver.cpp b/qxldod/driver.cpp
index f660304..f0d98c0 100755
--- a/qxldod/driver.cpp
+++ b/qxldod/driver.cpp
@@ -636,13 +636,11 @@ DodSystemDisplayWrite(
 #define RHEL_DEBUG_PORT     ((PUCHAR)0x3F8)
 #define TEMP_BUFFER_SIZE    256
 
-void DebugPrintFuncSerial(const char *format, ...)
+static void DebugPrintFuncSerial(const char *format, va_list list)
 {
     char buf[TEMP_BUFFER_SIZE];
     NTSTATUS status;
     size_t len;
-    va_list list;
-    va_start(list, format);
     status = RtlStringCbVPrintfA(buf, sizeof(buf), format, list);
     if (status == STATUS_SUCCESS)
     {
@@ -663,11 +661,17 @@ void DebugPrintFuncSerial(const char *format, ...)
 
 void DebugPrint(int level, const char *fmt, ...)
 {
+    va_list list;
+    if (level <= nDebugLevel) {
+        va_start(list, fmt);
+        DebugPrintFuncSerial(fmt, list);
+        va_end(list);
+    }
+
     static const ULONG xlate[] = { 0, 0, 1, 2, 3 };
     if (level <= 0 || level > 5)
         return;
 
-    va_list list;
     va_start(list, fmt);
     vDbgPrintEx(DPFLTR_IHVVIDEO_ID, xlate[level - 1], fmt, list);
     va_end(list);
diff --git a/qxldod/driver.h b/qxldod/driver.h
index b45d35e..fdd6184 100755
--- a/qxldod/driver.h
+++ b/qxldod/driver.h
@@ -210,23 +210,16 @@ DodSystemDisplayWrite(
 #if DBG
 
 extern int nDebugLevel;
-void DebugPrintFuncSerial(const char *format, ...);
 void DebugPrint(int level, const char *fmt, ...);
 
 #define DbgExpandArguments(...) __VA_ARGS__
 
-#define DbgPrint(level, line) do { \
-    if (level <= nDebugLevel) DebugPrintFuncSerial line; \
-    DebugPrint(level, DbgExpandArguments line); \
-} while(0)
-
+#define DbgPrint(level, line) \
+    DebugPrint(level, DbgExpandArguments line)
 #else
-#define DbgPrint(level, line)
+#define DbgPrint(level, line) {}
 #endif
 
-//    else if (0) DebugPrintFuncSerial line \
-
-
 #ifndef TRACE_LEVEL_INFORMATION
 #define TRACE_LEVEL_NONE        0   // Tracing is not on
 #define TRACE_LEVEL_FATAL       1   // Abnormal exit or termination
-- 
2.7.4



More information about the Spice-devel mailing list