From: Amos Jeffries Date: Mon, 18 Aug 2014 13:35:08 +0000 (-0700) Subject: Portability: remove short macro MB X-Git-Tag: SQUID_3_5_0_1~111 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c63f032234b0605e9c36c3c4b43d257033be6b8d;p=thirdparty%2Fsquid.git Portability: remove short macro MB 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. --- diff --git a/include/MemPool.h b/include/MemPool.h index 7e3716c9d6..2ce211ca49 100644 --- a/include/MemPool.h +++ b/include/MemPool.h @@ -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 ) diff --git a/lib/MemPool.cc b/lib/MemPool.cc index 3ab20e431f..6922bbc25f 100644 --- a/lib/MemPool.cc +++ b/lib/MemPool.cc @@ -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)