]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Portability fix: define non-macro variant of debug.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 13 Nov 2009 16:12:31 +0000 (17:12 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 13 Nov 2009 16:12:31 +0000 (17:12 +0100)
compat/debug.cc
compat/debug.h

index 9d307d571a64e1de63483208145c75784650df33..3a510988ea8767bc8f8a2ac10760ed64ea34ea9a 100644 (file)
@@ -1,4 +1,20 @@
-#include "config.h"
+#include "compat/debug.h"
 
 /* default off */
 int debug_enabled = 0;
+
+#ifndef __GNUC__
+/* under gcc a macro define in compat/debug.h is used instead */
+
+void
+debug(char *format,...)
+{
+    if (!debug_enabled)
+        return;
+    va_list args;
+    va_start (args,format);
+    vfprintf(stderr,format,args);
+    va_end(args);
+}
+
+#endif /* __GNUC__ */
index 01367403ad3d9050daa5ef6350dc77cf0bde14a8..b03d6361de8554cfa9c4b7abc37507532faa9bd6 100644 (file)
 
 /* Debugging stuff */
 
+SQUIDCEXTERN int debug_enabled;
+
 /* the macro overload style is really a gcc-ism */
 #ifdef __GNUC__
 
-SQUIDCEXTERN int debug_enabled;
 
 #define debug(X...) \
                      if (debug_enabled) { \
@@ -33,12 +34,8 @@ SQUIDCEXTERN int debug_enabled;
 
 #else /* __GNUC__ */
 
-/* TODO: non-GCC compilers can't do the above macro define yet. */
-inline void
-debug(char *format,...)
-{
-    ; // nothing to do.
-}
+/* non-GCC compilers can't do the above macro define yet. */
+void debug(char *format,...);
 #endif