From 7e4224e52a2202ba98dd93ffe209d231e5c1d35c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 3 Jul 2011 00:15:30 +0200 Subject: COMMON: Fix compilation when USE_HASHMAP_MEMORY_POOL is not defined. --- common/debug.cpp | 1 + common/hashmap.h | 11 ++++++++++- common/xmlparser.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/debug.cpp b/common/debug.cpp index 50f99753db..9c3a93e5a6 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -23,6 +23,7 @@ #include "common/debug-channels.h" #include "common/system.h" #include "common/textconsole.h" +#include "common/algorithm.h" #include // For va_list etc. diff --git a/common/hashmap.h b/common/hashmap.h index f2a4d843b8..347ac1fd25 100644 --- a/common/hashmap.h +++ b/common/hashmap.h @@ -106,8 +106,9 @@ private: HASHMAP_MEMORYPOOL_SIZE = HASHMAP_MIN_CAPACITY * HASHMAP_LOADFACTOR_NUMERATOR / HASHMAP_LOADFACTOR_DENOMINATOR }; - +#ifdef USE_HASHMAP_MEMORY_POOL ObjectPool _nodePool; +#endif Node **_storage; ///< hashtable of size arrsize. uint _mask; ///< Capacity of the HashMap minus one; must be a power of two of minus one @@ -128,12 +129,20 @@ private: #endif Node *allocNode(const Key &key) { +#ifdef USE_HASHMAP_MEMORY_POOL return new (_nodePool) Node(key); +#else + return new Node(key); +#endif } void freeNode(Node *node) { if (node && node != HASHMAP_DUMMY_NODE) +#ifdef USE_HASHMAP_MEMORY_POOL _nodePool.deleteChunk(node); +#else + delete node; +#endif } void assign(const HM_t &map); diff --git a/common/xmlparser.h b/common/xmlparser.h index 40c779b87e..d75dc0e4a9 100644 --- a/common/xmlparser.h +++ b/common/xmlparser.h @@ -31,6 +31,7 @@ #include "common/hashmap.h" #include "common/hash-str.h" #include "common/stack.h" +#include "common/memorypool.h" namespace Common { -- cgit v1.2.3