]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Portability: remove short macro MB
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 18 Aug 2014 13:35:08 +0000 (06:35 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 18 Aug 2014 13:35:08 +0000 (06:35 -0700)
Very short macros have an increased liklihood of clashing with system
definitions of other symbols. In this case with a typedef in MinGW.

As the MB macro was limited to use in MemPool.* simply inline its
definition.

include/MemPool.h
lib/MemPool.cc

index 7e3716c9d6ac7b1fa48890726bd84a3c0a3ed4af..2ce211ca49f5a3f56326f2bab92602af0bcde62b 100644 (file)
@@ -42,9 +42,7 @@
 #endif
 
 /// \ingroup MemPoolsAPI
-#define MB ((size_t)1024*1024)
-/// \ingroup MemPoolsAPI
-#define toMB(size) ( ((double) size) / MB )
+#define toMB(size) ( ((double) size) / ((double)(1024*1024)) )
 /// \ingroup MemPoolsAPI
 #define toKB(size) ( (size + 1024 - 1) / 1024 )
 
index 3ab20e431f6a3f3063405c886cdabd756035d51e..6922bbc25f8bd06e17821bc07e4d421389d5dfef 100644 (file)
@@ -113,8 +113,8 @@ MemPools::idleLimit() const
  * all pools - including those used before main() starts where
  * MemPools::GetInstance().setDefaultPoolChunking() can be called.
  */
-MemPools::MemPools() : pools(NULL), mem_idle_limit(2 * MB),
-        poolCount (0), defaultIsChunked (USE_CHUNKEDMEMPOOLS && !RUNNING_ON_VALGRIND)
+MemPools::MemPools() : pools(NULL), mem_idle_limit(2 << 20 /* 2 MB */),
+        poolCount(0), defaultIsChunked(USE_CHUNKEDMEMPOOLS && !RUNNING_ON_VALGRIND)
 {
     char *cfg = getenv("MEMPOOLS");
     if (cfg)