Hi,
  this patch removes code depending on MEM_GEN_TRACE. I haven't seen this
code used in years, like all other memory-management debug code.

-- 
    Francesco
=== modified file 'compat/xalloc.cc'
--- compat/xalloc.cc	2014-03-17 11:04:57 +0000
+++ compat/xalloc.cc	2014-03-17 11:18:01 +0000
@@ -89,10 +89,6 @@
 #if XMALLOC_STATISTICS
     malloc_stat(sz * n);
 #endif
-#if MEM_GEN_TRACE
-    if (tracefp)
-        fprintf(tracefp, "c:%u:%u:%p\n", (unsigned int) n, (unsigned int) sz, p);
-#endif
 
     PROF_stop(xcalloc);
     return p;
@@ -124,10 +120,6 @@
 #if XMALLOC_STATISTICS
     malloc_stat(sz);
 #endif
-#if MEM_GEN_TRACE
-    if (tracefp)
-        fprintf(tracefp, "m:%d:%p\n", sz, p);
-#endif
 
     PROF_stop(xmalloc);
     return (p);
@@ -160,10 +152,7 @@
 #if XMALLOC_STATISTICS
     malloc_stat(sz);
 #endif
-#if MEM_GEN_TRACE
-    if (tracefp)                /* new ptr, old ptr, new size */
-        fprintf(tracefp, "r:%p:%p:%d\n", p, s, sz);
-#endif
+
     PROF_stop(xrealloc);
     return (p);
 }
@@ -177,10 +166,5 @@
     PROF_start(free);
     free(s);
     PROF_stop(free);
-
-#if MEM_GEN_TRACE
-    if (tracefp)
-        fprintf(tracefp, "f:%p\n", s);
-#endif
     PROF_stop(free_const);
 }

=== modified file 'configure.ac'
--- configure.ac	2014-03-17 11:04:57 +0000
+++ configure.ac	2014-03-17 11:18:01 +0000
@@ -1053,18 +1053,6 @@
 fi
 AC_SUBST(ADAPTATION_LIBS)
 
-
-dnl This is a developer only option. Developers know how to set defines
-dnl
-dnl AC_ARG_ENABLE(mem-gen-trace,
-dnl [  --enable-mem-gen-trace  Do trace of memory stuff],
-dnl [ if test "$enableval" = "yes" ; then
-dnl     AC_MSG_NOTICE([Memory trace (to file) enabled])
-dnl     AC_DEFINE(MEM_GEN_TRACE,1,[Define for log file trace of mem alloc/free])
-dnl   fi
-dnl ])
-
-
 test "x$squid_host_os" = "xmingw" && enable_wccp=no
 AC_ARG_ENABLE(wccp,
   AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]), [

=== modified file 'lib/malloc_trace.cc'
--- lib/malloc_trace.cc	2014-03-17 11:04:57 +0000
+++ lib/malloc_trace.cc	2014-03-17 11:18:01 +0000
@@ -50,27 +50,3 @@
 #include <malloc.h>
 #endif
 
-#if MEM_GEN_TRACE
-
-static FILE *tracefp = NULL;
-
-void
-log_trace_init(char *fn)
-{
-    tracefp = fopen(fn, "a+");
-
-    if (!tracefp) {
-        perror("log_trace_init");
-        exit(1);
-    }
-}
-
-void
-log_trace_done()
-{
-    fclose(tracefp);
-    tracefp = NULL;
-}
-
-#endif
-

=== modified file 'src/main.cc'
--- src/main.cc	2014-03-16 12:44:59 +0000
+++ src/main.cc	2014-03-17 11:18:01 +0000
@@ -189,10 +189,6 @@
 static void serverConnectionsClose(void);
 static void watch_child(char **);
 static void setEffectiveUser(void);
-#if MEM_GEN_TRACE
-void log_trace_done();
-void log_trace_init(char *);
-#endif
 static void SquidShutdown(void);
 static void mainSetCwd(void);
 static int checkRunningPid(void);
@@ -1001,12 +997,6 @@
 
     fd_open(fileno(debug_log), FD_LOG, Debug::cache_log);
 
-#if MEM_GEN_TRACE
-
-    log_trace_init("/tmp/squid.alloc");
-
-#endif
-
     debugs(1, DBG_CRITICAL, "Starting Squid Cache version " << version_string << " for " << CONFIG_HOST_TYPE << "...");
     debugs(1, DBG_CRITICAL, "Service Name: " << service_name);
 
@@ -1923,12 +1913,6 @@
 
     RunRegisteredHere(RegisteredRunner::finishShutdown);
 
-#if MEM_GEN_TRACE
-
-    log_trace_done();
-
-#endif
-
     if (IamPrimaryProcess()) {
         if (Config.pidFilename && strcmp(Config.pidFilename, "none") != 0) {
             enter_suid();

=== modified file 'src/tools.cc'
--- src/tools.cc	2014-02-18 11:39:58 +0000
+++ src/tools.cc	2014-03-17 11:18:01 +0000
@@ -82,10 +82,6 @@
 Thanks!\n"
 
 static void mail_warranty(void);
-#if MEM_GEN_TRACE
-void log_trace_done();
-void log_trace_init(char *);
-#endif
 static void restoreCapabilities(int keep);
 int DebugSignal = -1;
 
@@ -463,22 +459,10 @@
     DebugSignal = sig;
 
     if (state == 0) {
-#if !MEM_GEN_TRACE
         Debug::parseOptions("ALL,7");
-#else
-
-        log_trace_done();
-#endif
-
         state = 1;
     } else {
-#if !MEM_GEN_TRACE
         Debug::parseOptions(Debug::debugOptions);
-#else
-
-        log_trace_init("/tmp/squid.alloc");
-#endif
-
         state = 0;
     }
 

Reply via email to