]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: Remove more traces of old squid debug()() macro
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 28 Aug 2009 01:44:26 +0000 (13:44 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 28 Aug 2009 01:44:26 +0000 (13:44 +1200)
There is now no reason for any of the Squid internal code to contain 'debug()'

TODO: Just the ESI code remaining on the old system.
  It's debug seems to be incrementally building a single line to display
  objects parsed. But using multiple nested calls to dump it.
  VERY nasty. They need to be made writing to a buffer instead.

include/RefCount.h
src/Debug.h
src/HttpStatusLine.cc
src/client_side.h
src/defines.h
src/esi/Expression.cc
src/protos.h
src/snmp_core.cc
src/tools.cc
test-suite/test_tools.cc

index 527ae4ff6b340bbe6167c159d19d45dafff8d3f8..d1ef4d62706da13492d04b1126787c297fa3dd49 100644 (file)
@@ -119,7 +119,7 @@ struct RefCountable_ {
     /* Not private, to allow class hierarchies */
     void RefCountReference() const {
 #if REFCOUNT_DEBUG
-        debug (0,1)("Incrementing this %p from count %u\n",this,count_);
+       old_debug(0,1)("Incrementing this %p from count %u\n",this,count_);
 #endif
 
         ++count_;
@@ -127,7 +127,7 @@ struct RefCountable_ {
 
     unsigned RefCountDereference() const {
 #if REFCOUNT_DEBUG
-        debug (0,1)("Decrementing this %p from count %u\n",this,count_);
+        old_debug(0,1)("Decrementing this %p from count %u\n",this,count_);
 #endif
 
         return --count_;
index 6e4c13c64d4a2d83c46892f8fd1b5aff99b3ddd0..b2134c1bc333298506e4ac0a9a49b9b2f5b09b34 100644 (file)
@@ -103,7 +103,6 @@ extern FILE *debug_log;
 const size_t BuildPrefixInit();
 const char * SkipBuildPrefix(const char* path);
 
-
 /* Debug stream */
 #define debugs(SECTION, LEVEL, CONTENT) \
    do { \
@@ -137,4 +136,10 @@ inline std::ostream& operator <<(std::ostream &os, const uint8_t d)
     return (os << (int)d);
 }
 
+/* Legacy debug style. Still used in some places. needs to die... */
+#define do_debug(SECTION, LEVEL) ((Debug::level = (LEVEL)) > Debug::Levels[SECTION])
+#define old_debug(SECTION, LEVEL) \
+        do_debug(SECTION, LEVEL) ? (void) 0 : _db_print
+
+
 #endif /* SQUID_DEBUG_H */
index 1e5aeb738e1c964e985370dbfe83cfccac5ba541..eb797c5a17f5797dba3fc72347bbc6f8eaae3f4b 100644 (file)
@@ -71,9 +71,9 @@ httpStatusLinePackInto(const HttpStatusLine * sline, Packer * p)
 {
     assert(sline && p);
     debugs(57, 9, "packing sline " << sline << " using " << p << ":");
-    debug(57, 9) (HttpStatusLineFormat, sline->version.major,
-                  sline->version.minor, sline->status,
-                  sline->reason ? sline->reason : httpStatusString(sline->status));
+    debugs(57, 9, "FORMAT=" << HttpStatusLineFormat );
+    debugs(57, 9, "HTTP/" << sline->version.major << "." << sline->version.minor <<
+                 " " << sline->status << " " << (sline->reason ? sline->reason : httpStatusString(sline->status)) );
     packerPrintf(p, HttpStatusLineFormat, sline->version.major,
                  sline->version.minor, sline->status, httpStatusLineReason(sline));
 }
index 1a62846f167be960418b81553df2258a2bd67fab..d3761a6125ce2119d3cc1be7020d8355f2962b2c 100644 (file)
@@ -81,8 +81,7 @@ public:
 
     void mayUseConnection(bool aBool) {
         mayUseConnection_ = aBool;
-        debug (33,3)("ClientSocketContext::mayUseConnection: This %p marked %d\n",
-                     this, aBool);
+        debugs(33,3, HERE << "This " << this << " marked " << aBool);
     }
 
     class DeferredParams
index ac6ace1e5842539ce08ac744524c6668e759c547..c54093d3be6860d238eb838e32d8001eede844ef 100644 (file)
 #define COMM_REUSEADDR         0x04
 #define COMM_TRANSPARENT       0x08
 
-#include "Debug.h"
-#define do_debug(SECTION, LEVEL) ((Debug::level = (LEVEL)) > Debug::Levels[SECTION])
-#define debug(SECTION, LEVEL) \
-        do_debug(SECTION, LEVEL) ? (void) 0 : _db_print
-
 #define safe_free(x)   if (x) { xxfree(x); x = NULL; }
 
 #define DISK_OK                   (0)
index 759171842d1ca7884b5bf04cfc7f452e6324b1f3..aaace55c3a988c27fe0fd8436ae9e09f4285e07b 100644 (file)
@@ -881,23 +881,23 @@ printliteral (stackmember s)
     switch (s.valuestored) {
 
     case ESI_LITERAL_INVALID:
-        debug(86, 1) ( " Invalid " );
+        old_debug(86, 1) ( " Invalid " );
         break;
 
     case ESI_LITERAL_FLOAT:
-        debug (86,1) ("%f", s.value.floating);
+        old_debug(86,1) ("%f", s.value.floating);
         break;
 
     case ESI_LITERAL_STRING:
-        debug (86,1) ("'%s'", s.value.string);
+        old_debug(86,1) ("'%s'", s.value.string);
         break;
 
     case ESI_LITERAL_INT:
-        debug (86,1) ("%d", s.value.integral);
+        old_debug(86,1) ("%d", s.value.integral);
         break;
 
     case ESI_LITERAL_BOOL:
-        debug (86,1)("%s",s.value.integral ? "true" : "false");
+        old_debug(86,1)("%s",s.value.integral ? "true" : "false");
     }
 }
 
@@ -907,7 +907,7 @@ printmember (stackmember s)
     switch (s.valuetype) {
 
     case ESI_EXPR_INVALID:
-        debug (86,1) (" Invalid ");
+        old_debug(86,1) (" Invalid ");
         break;
 
     case ESI_EXPR_LITERAL:
@@ -915,51 +915,51 @@ printmember (stackmember s)
         break;
 
     case ESI_EXPR_EXPR:
-        debug (86,1) ("%s", s.value.integral ? "true" : "false");
+        old_debug(86,1) ("%s", s.value.integral ? "true" : "false");
         break;
 
     case ESI_EXPR_OR:
-        debug (86,1) ("|");
+        old_debug(86,1) ("|");
         break;
 
     case ESI_EXPR_AND:
-        debug (86,1) ("&");
+        old_debug(86,1) ("&");
         break;
 
     case ESI_EXPR_NOT:
-        debug (86,1) ("!");
+        old_debug(86,1) ("!");
         break;
 
     case ESI_EXPR_START:
-        debug (86,1) ("(");
+        old_debug(86,1) ("(");
         break;
 
     case ESI_EXPR_END:
-        debug (86,1) (")");
+        old_debug(86,1) (")");
         break;
 
     case ESI_EXPR_EQ:
-        debug (86,1) ("==");
+        old_debug(86,1) ("==");
         break;
 
     case ESI_EXPR_NOTEQ:
-        debug (86,1) ("!=");
+        old_debug(86,1) ("!=");
         break;
 
     case ESI_EXPR_LESS:
-        debug (86,1) ("<");
+        old_debug(86,1) ("<");
         break;
 
     case ESI_EXPR_LESSEQ:
-        debug (86,1) ("<=");
+        old_debug(86,1) ("<=");
         break;
 
     case ESI_EXPR_MORE:
-        debug (86,1) (">");
+        old_debug(86,1) (">");
         break;
 
     case ESI_EXPR_MOREEQ:
-        debug (86,1) (">=");
+        old_debug(86,1) (">=");
         break;
     }
 }
@@ -973,7 +973,7 @@ dumpstack (stackmember * stack, int depth)
         printmember (stack[i]);
 
     if (depth)
-        debug (86,1) ("\n");
+        old_debug(86,1) ("\n");
 }
 
 int
index 820ae355360311a2a21b0d174a7513c9a2240bf9..459820d3bc0766cbb8620526a10e49fc2af91e85 100644 (file)
@@ -97,6 +97,7 @@ SQUIDCEXTERN void httpRequestFree(void *);
 
 extern void clientAccessCheck(void *);
 
+#include "Debug.h"
 /* see debug.c for info on context-based debugging */
 SQUIDCEXTERN Ctx ctx_enter(const char *descr);
 SQUIDCEXTERN void ctx_exit(Ctx ctx);
@@ -107,7 +108,7 @@ SQUIDCEXTERN void _db_rotate_log(void);
 
 SQUIDCEXTERN void _db_print(const char *,...) PRINTF_FORMAT_ARG1;
 
-/* packs, then prints an object using debug() */
+/* packs, then prints an object using debugs() */
 SQUIDCEXTERN void debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm);
 
 /* disk.c */
index d545548de064d228d3450cabfdac8b199b132552..7bbdf893dfdeb4c49ca89d14fff4df4729f96e60 100644 (file)
@@ -1051,7 +1051,7 @@ snmpDebugOid(int lvl, oid * Name, snint Len)
 static void
 snmpSnmplibDebug(int lvl, char *buf)
 {
-    debug(49, lvl) ("%s", buf);
+    debugs(49, lvl, buf);
 }
 
 
index 311f007fc36698bccefc512d164938c62662a247..e3e2323ee140c4b4bef46f7e9827c4f126de9c6f 100644 (file)
@@ -395,7 +395,7 @@ void
 sigusr2_handle(int sig)
 {
     static int state = 0;
-    /* no debug() here; bad things happen if the signal is delivered during _db_print() */
+    /* no debugs() here; bad things happen if the signal is delivered during _db_print() */
 
     if (state == 0) {
 #ifndef MEM_GEN_TRACE
@@ -555,7 +555,7 @@ sig_child(int sig)
 
         pid = waitpid(-1, &status, WNOHANG);
 #endif
-        /* no debug() here; bad things happen if the signal is delivered during _db_print() */
+        /* no debugs() here; bad things happen if the signal is delivered during _db_print() */
 #if HAVE_SIGACTION
 
     } while (pid > 0);
index 4ebcf4b94d64e66de9eca86d15c4bc34f8f67ef0..8e95c2c7fb44642c58b5092cb7453448af44258b 100644 (file)
@@ -67,14 +67,14 @@ _db_print_stderr(const char *format, va_list args)
 void
 fatal_dump(const char *message)
 {
-    debug (0,0) ("Fatal: %s",message);
+    fprintf(stderr, "Fatal: %s",message);
     exit (1);
 }
 
 void
 fatal(const char *message)
 {
-    debug (0,0) ("Fatal: %s",message);
+    fprintf(stderr, "Fatal: %s", message);
     exit (1);
 }
 
@@ -150,7 +150,7 @@ Debug::xassert(const char *msg, const char *file, int line)
     abort();
 }
 
-std::ostringstream *Debug::CurrentDebug (NULL);
+std::ostringstream *Debug::CurrentDebug(NULL);
 
 MemAllocator *dlink_node_pool = NULL;