]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
changed mempools option handling
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 14 Apr 2010 21:04:28 +0000 (23:04 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 14 Apr 2010 21:04:28 +0000 (23:04 +0200)
simplified default value handling for some options

configure.in
lib/MemPool.cc
test-suite/MemPoolTest.cc

index dad2cac7e76860ef1d8f6efd3b1294c5371e1a00..a798aedd92f44652abe25a90fec6bc0ce3f01d0b 100644 (file)
@@ -2001,26 +2001,19 @@ AC_ARG_WITH(valgrind-debug,
 ])
 
 dnl Disable "memPools" code
-squid_opt_enable_mempools=yes #default
 AC_ARG_ENABLE(mempools,
   AS_HELP_STRING([--disable-mempools],
                  [Disable memPools. Note that this option now simply sets the
                   default behaviour. Specific classes can override this 
                   at runtime, and only lib/MemPool.c needs to be altered 
                   to change the squid-wide default for all classes.]), [ 
-SQUID_YESNO([$squid_opt_enable_mempools],
+SQUID_YESNO([$enableval],
             [--disable-mempools option takes no arguments])
-squid_opt_enable_mempools=$enableval 
 ])
-# transform positive to negative value.
-AC_MSG_NOTICE([MemPools enabled: $squid_opt_enable_mempools])
-if test "$squid_opt_enable_mempools" = "yes" ; then
-  squid_opt_enable_mempools=no
-else
-  squid_opt_enable_mempools=yes
-fi
-SQUID_DEFINE_UNQUOTED(DISABLE_POOLS,$squid_opt_enable_mempools,
+# notice: the definition's value meaning is INVERTED
+SQUID_DEFINE_UNQUOTED(USE_MEMPOOLS,${enable_mempools:=yes},
    [Disable Memory Pools support and fall back to system malloc])
+AC_MSG_NOTICE([MemPools enabled: $enable_mempools])
 
 dnl Enable WIN32 Service compile mode
 AC_ARG_ENABLE(win32-service,
@@ -2053,17 +2046,15 @@ if test "$squid_require_sasl" = "yes"; then
 fi
 
 # Disable "unlinkd" code
-squid_opt_enable_unlinkd=yes
 AC_ARG_ENABLE(unlinkd,
   AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
 SQUID_YESNO([$enableval],
             [unrecognized argument to --disable-unlinkd: $enableval])
-squid_opt_enable_unlinkd=$enableval
 ])
-AC_MSG_NOTICE([unlinkd enabled: $squid_opt_enable_unlinkd])
-SQUID_DEFINE_UNQUOTED([USE_UNLINKD],$squid_opt_enable_unlinkd,
+SQUID_DEFINE_UNQUOTED([USE_UNLINKD],${enable_unlinkd:=yes},
                       [Enable useage of unlinkd])
-AM_CONDITIONAL(ENABLE_UNLINKD,test "$squid_opt_enable_unlinkd" = "yes")
+AM_CONDITIONAL(ENABLE_UNLINKD,test "$enable_unlinkd" = "yes")
+AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
 
 # Enable backtraces on fatal errors
 AC_ARG_ENABLE(stacktraces,
index c09b897633eb5291847e284135104b7592929ab3..3266bae8051ccbc82343b4b025342dfde3448831 100644 (file)
@@ -359,7 +359,7 @@ MemPool::createChunk()
  * MemPools::GetInstance().setDefaultPoolChunking() can be called.
  */
 MemPools::MemPools() : pools(NULL), mem_idle_limit(2 * MB),
-        poolCount (0), defaultIsChunked (!DISABLE_POOLS && !RUNNING_ON_VALGRIND)
+        poolCount (0), defaultIsChunked (USE_MEMPOOLS && !RUNNING_ON_VALGRIND)
 {
     char *cfg = getenv("MEMPOOLS");
     if (cfg)
index f44177e305504e0227d89702c5b924df41f3b5c5..1ce1e934f597ee8bcc6112eaac07cd9f647b676c 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "squid.h"
 
-#if !DISABLE_POOLS
+#if USE_MEMPOOLS
 
 #include "MemPool.h"
 
@@ -82,12 +82,12 @@ MemPoolTest::run()
     delete Pool;
 }
 
-#endif /* DISABLE_POOLS */
+#endif /* USE_MEMPOOLS */
 
 int
 main (int argc, char **argv)
 {
-#if !DISABLE_POOLS
+#if USE_MEMPOOLS
     MemPoolTest aTest;
     aTest.run();
 #endif