mesa: fix formatting of messages printed using _mesa_log
[mesa.git] / src / mesa / main / errors.c
index b3487efb5225955050b4601b944f2d917b6ac7aa..02517c1c4078decd75428b936b6e2594b1ac8e0e 100644 (file)
@@ -32,7 +32,7 @@
 #include <stdio.h>
 #include "errors.h"
 #include "enums.h"
-#include "util/imports.h"
+
 #include "context.h"
 #include "debug_output.h"
 
@@ -82,11 +82,14 @@ output_if_debug(const char *prefixString, const char *outputString,
       fflush(LogFile);
 
 #if defined(_WIN32)
-      /* stderr from windows applications without console is not usually 
-       * visible, so communicate with the debugger instead */ 
+      /* stderr from windows applications without console is not usually
+       * visible, so communicate with the debugger instead */
       {
          char buf[4096];
-         snprintf(buf, sizeof(buf), "%s: %s%s", prefixString, outputString, newline ? "\n" : "");
+         if (prefixString)
+            snprintf(buf, sizeof(buf), "%s: %s%s", prefixString, outputString, newline ? "\n" : "");
+         else
+            snprintf(buf, sizeof(buf), "%s%s", outputString, newline ? "\n" : "");
          OutputDebugStringA(buf);
       }
 #endif
@@ -399,7 +402,7 @@ _mesa_log(const char *fmtString, ...)
    va_start(args, fmtString);
    vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args);
    va_end(args);
-   output_if_debug("", s, GL_FALSE);
+   output_if_debug(NULL, s, GL_FALSE);
 }