]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Maintenance: Remove debug_log wrapper (#1833)
authorAmos Jeffries <yadij@users.noreply.github.com>
Thu, 6 Jun 2024 20:00:05 +0000 (20:00 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 6 Jun 2024 20:00:09 +0000 (20:00 +0000)
src/client_side.cc
src/debug/Stream.h
src/fd.cc
src/ipc.cc
src/ipc_win32.cc
src/ssl/support.cc
src/tools.cc

index 21d0d85ba955933dfafac4e8ccf95ae4497ab3c8..2a977e34d7e2eab0cb33ab65c80550b184b6ab84 100644 (file)
@@ -2308,10 +2308,10 @@ clientNegotiateSSL(int fd, void *data)
         if (Debug::Enabled(83, 4)) {
             /* Write out the SSL session details.. actually the call below, but
              * OpenSSL headers do strange typecasts confusing GCC.. */
-            /* PEM_write_SSL_SESSION(debug_log, SSL_get_session(ssl)); */
+            /* PEM_write_SSL_SESSION(DebugStream(), SSL_get_session(ssl)); */
 #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x00908000L
             PEM_ASN1_write(reinterpret_cast<i2d_of_void *>(i2d_SSL_SESSION),
-                           PEM_STRING_SSL_SESSION, debug_log,
+                           PEM_STRING_SSL_SESSION, DebugStream(),
                            reinterpret_cast<char *>(SSL_get_session(session.get())),
                            nullptr, nullptr, 0, nullptr, nullptr);
 
@@ -2325,11 +2325,11 @@ clientNegotiateSSL(int fd, void *data)
             * commented line. */
 
             PEM_ASN1_write((int(*)())i2d_SSL_SESSION, PEM_STRING_SSL_SESSION,
-                           debug_log,
+                           DebugStream(),
                            reinterpret_cast<char *>(SSL_get_session(session.get())),
                            nullptr, nullptr, 0, nullptr, nullptr);
             /* PEM_ASN1_write((int(*)(...))i2d_SSL_SESSION, PEM_STRING_SSL_SESSION,
-                           debug_log,
+                           DebugStream(),
                            reinterpret_cast<char *>(SSL_get_session(session.get())),
                            nullptr, nullptr, 0, nullptr, nullptr);
              */
index 7308e4aae8bd5bc887dc717d7089835cab93b41e..156a8c05f20891eda33697492c99730261f7ba5b 100644 (file)
@@ -179,8 +179,6 @@ private:
 /// cache.log FILE or, as the last resort, stderr stream;
 /// may be nil during static initialization and destruction!
 FILE *DebugStream();
-/// change-avoidance macro; new code should call DebugStream() instead
-#define debug_log DebugStream()
 
 /// a hack for low-level file descriptor manipulations in ipcCreate()
 void ResyncDebugLog(FILE *newDestination);
index 8a69d44ca7ff7f295734de3f8ad01d4522c7eb66..aad446a48f9e0421375c8645bb9e10c0642d643c 100644 (file)
--- a/src/fd.cc
+++ b/src/fd.cc
@@ -252,7 +252,7 @@ fdDumpOpen(void)
         if (!F->flags.open)
             continue;
 
-        if (i == fileno(debug_log))
+        if (i == fileno(DebugStream()))
             continue;
 
         debugs(51, Important(17), "Open FD "<< std::left<< std::setw(10) <<
index 1afc4d5cf3c1882384876f19bf771e2b29b107d1..0de228439ea25663034eec13ef32eee2620748c8 100644 (file)
@@ -385,7 +385,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
 
     /*
      * This double-dup stuff avoids problems when one of
-     *  crfd, cwfd, or debug_log are in the rage 0-2.
+     *  crfd, cwfd, or DebugStream() are in the rage 0-2.
      */
 
     do {
@@ -399,7 +399,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
 
     t2 = dupOrExit(cwfd);
 
-    t3 = dupOrExit(fileno(debug_log));
+    t3 = dupOrExit(fileno(DebugStream()));
 
     assert(t1 > 2 && t2 > 2 && t3 > 2);
 
@@ -407,7 +407,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
 
     close(cwfd);
 
-    close(fileno(debug_log));
+    close(fileno(DebugStream()));
 
     dup2(t1, 0);
 
index 067f39cbf4edaea16190ebec4e47a2ed2dc05537..f80df84cd3330666c8c20137775ba758bfd9f9b7 100644 (file)
@@ -522,7 +522,7 @@ ipc_thread_1(void *in_params)
 
     dup2(p2c[1], 1);
 
-    dup2(fileno(debug_log), 2);
+    dup2(fileno(DebugStream()), 2);
 
     close(c2p[0]);
 
index 753d491e6c00b04b445ed7249ed9717f57f694ad..e55c78604729eb9932c1974a495c122527a9f1a7 100644 (file)
@@ -158,7 +158,7 @@ ssl_temp_rsa_cb(SSL *, int, int keylen)
 
     if (newkey) {
         if (Debug::Enabled(83, 5))
-            PEM_write_RSAPrivateKey(debug_log, rsa, nullptr, nullptr, 0, nullptr, nullptr);
+            PEM_write_RSAPrivateKey(DebugStream(), rsa, nullptr, nullptr, 0, nullptr, nullptr);
 
         debugs(83, DBG_IMPORTANT, "Generated ephemeral RSA key of length " << keylen);
     }
index ae3eb0a5d8379520937febf2159b6f566a193154..ff87b01aaa26350ace4fc92715f7343fb92389b8 100644 (file)
@@ -168,9 +168,9 @@ dumpMallocStats(void)
 #if HAVE_MSTATS && HAVE_GNUMALLOC_H
 
     struct mstats ms = mstats();
-    fprintf(debug_log, "\ttotal space in arena:  %6d KB\n",
+    fprintf(DebugStream(), "\ttotal space in arena:  %6d KB\n",
             (int) (ms.bytes_total >> 10));
-    fprintf(debug_log, "\tTotal free:            %6d KB %d%%\n",
+    fprintf(DebugStream(), "\tTotal free:            %6d KB %d%%\n",
             (int) (ms.bytes_free >> 10),
             Math::intPercent(ms.bytes_free, ms.bytes_total));
 #endif
@@ -331,13 +331,13 @@ PrintRusage(void)
 
     struct rusage rusage;
     squid_getrusage(&rusage);
-    fprintf(debug_log, "CPU Usage: %.3f seconds = %.3f user + %.3f sys\n",
+    fprintf(DebugStream(), "CPU Usage: %.3f seconds = %.3f user + %.3f sys\n",
             rusage_cputime(&rusage),
             rusage.ru_utime.tv_sec + ((double) rusage.ru_utime.tv_usec / 1000000.0),
             rusage.ru_stime.tv_sec + ((double) rusage.ru_stime.tv_usec / 1000000.0));
-    fprintf(debug_log, "Maximum Resident Size: %d KB\n",
+    fprintf(DebugStream(), "Maximum Resident Size: %d KB\n",
             rusage_maxrss(&rusage));
-    fprintf(debug_log, "Page faults with physical i/o: %d\n",
+    fprintf(DebugStream(), "Page faults with physical i/o: %d\n",
             rusage_pagefaults(&rusage));
 }
 
@@ -355,8 +355,8 @@ death(int sig)
 #if _SQUID_HPUX_
     {
         extern void U_STACK_TRACE(void);    /* link with -lcl */
-        fflush(debug_log);
-        dup2(fileno(debug_log), 2);
+        fflush(DebugStream());
+        dup2(fileno(DebugStream()), 2);
         U_STACK_TRACE();
     }
 
@@ -364,8 +364,8 @@ death(int sig)
 #if _SQUID_SOLARIS_ && HAVE_LIBOPCOM_STACK
     {   /* get ftp://opcom.sun.ca/pub/tars/opcom_stack.tar.gz and */
         extern void opcom_stack_trace(void);    /* link with -lopcom_stack */
-        fflush(debug_log);
-        dup2(fileno(debug_log), fileno(stdout));
+        fflush(DebugStream());
+        dup2(fileno(DebugStream()), fileno(stdout));
         opcom_stack_trace();
         fflush(stdout);
     }
@@ -376,7 +376,7 @@ death(int sig)
         static void *callarray[8192];
         int n;
         n = backtrace(callarray, 8192);
-        backtrace_symbols_fd(callarray, n, fileno(debug_log));
+        backtrace_symbols_fd(callarray, n, fileno(DebugStream()));
     }
 
 #endif
@@ -930,8 +930,8 @@ squid_signal(int sig, SIGHDLR * func, int flags)
 void
 logsFlush(void)
 {
-    if (debug_log)
-        fflush(debug_log);
+    if (DebugStream())
+        fflush(DebugStream());
 }
 
 void