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

Frediano Ziglio fziglio at redhat.com
Wed Apr 12 13:19:50 UTC 2017


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 b6a9b95..2736eb4 100755
--- a/qxldod/driver.cpp
+++ b/qxldod/driver.cpp
@@ -741,13 +741,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)
     {
@@ -768,11 +766,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 d92f5c8..a70b0e7 100755
--- a/qxldod/driver.h
+++ b/qxldod/driver.h
@@ -235,23 +235,16 @@ DodGetScanLine(
 #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.9.3



More information about the Spice-devel mailing list