From c63f032234b0605e9c36c3c4b43d257033be6b8d Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 18 Aug 2014 06:35:08 -0700 Subject: [PATCH] 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. --- include/MemPool.h | 4 +--- lib/MemPool.cc | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) 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) -- 2.47.3