shithub: puzzles

Download patch

ref: b3af872f3c9e4547ea27d914a463bb5e63f6fd07
parent: 7aefa1110afd73c9bfba0ba3af34e8ce78b96ce6
author: Simon Tatham <anakin@pobox.com>
date: Tue Jan 12 18:32:22 EST 2010

Patch from James H: make the Windows debugging output conditional on
an enabling environment variable.

[originally from svn r8834]

--- a/windows.c
+++ b/windows.c
@@ -154,11 +154,17 @@
 {
     char buf[4096];
     va_list ap;
+    static int debugging = -1;
 
-    va_start(ap, fmt);
-    _vsnprintf(buf, 4095, fmt, ap);
-    dputs(buf);
-    va_end(ap);
+    if (debugging == -1)
+        debugging = getenv("DEBUG_PUZZLES") ? 1 : 0;
+
+    if (debugging) {
+        va_start(ap, fmt);
+        _vsnprintf(buf, 4095, fmt, ap);
+	dputs(buf);
+        va_end(ap);
+    }
 }
 #endif