From: Amos Jeffries Date: Thu, 6 Jun 2024 20:00:05 +0000 (+0000) Subject: Maintenance: Remove debug_log wrapper (#1833) X-Git-Tag: SQUID_7_0_1~108 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=016c612a77ac4f880ec2ed35e1c8fa9a73c3a2dd;p=thirdparty%2Fsquid.git Maintenance: Remove debug_log wrapper (#1833) --- diff --git a/src/client_side.cc b/src/client_side.cc index 21d0d85ba9..2a977e34d7 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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_SSL_SESSION), - PEM_STRING_SSL_SESSION, debug_log, + PEM_STRING_SSL_SESSION, DebugStream(), reinterpret_cast(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(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(SSL_get_session(session.get())), nullptr, nullptr, 0, nullptr, nullptr); */ diff --git a/src/debug/Stream.h b/src/debug/Stream.h index 7308e4aae8..156a8c05f2 100644 --- a/src/debug/Stream.h +++ b/src/debug/Stream.h @@ -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); diff --git a/src/fd.cc b/src/fd.cc index 8a69d44ca7..aad446a48f 100644 --- 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) << diff --git a/src/ipc.cc b/src/ipc.cc index 1afc4d5cf3..0de228439e 100644 --- a/src/ipc.cc +++ b/src/ipc.cc @@ -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); diff --git a/src/ipc_win32.cc b/src/ipc_win32.cc index 067f39cbf4..f80df84cd3 100644 --- a/src/ipc_win32.cc +++ b/src/ipc_win32.cc @@ -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]); diff --git a/src/ssl/support.cc b/src/ssl/support.cc index 753d491e6c..e55c786047 100644 --- a/src/ssl/support.cc +++ b/src/ssl/support.cc @@ -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); } diff --git a/src/tools.cc b/src/tools.cc index ae3eb0a5d8..ff87b01aaa 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -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