aboutsummaryrefslogtreecommitdiff
path: root/common/hashmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/hashmap.h')
-rw-r--r--common/hashmap.h27
1 files changed, 3 insertions, 24 deletions
diff --git a/common/hashmap.h b/common/hashmap.h
index 81f5ee84b4..bbc227b3ae 100644
--- a/common/hashmap.h
+++ b/common/hashmap.h
@@ -37,15 +37,6 @@
#define USE_HASHMAP_MEMORY_POOL
#ifdef USE_HASHMAP_MEMORY_POOL
#include "common/memorypool.h"
-// FIXME: we sadly can't assume standard C++ to be present
-// on every system we support, so we should get rid of this.
-// The solution should be to write a simple placement new
-// on our own.
-
-// Symbian does not have <new> but the new operator
-#if !defined(__SYMBIAN32__)
-#include <new>
-#endif
#endif
namespace Common {
@@ -100,27 +91,15 @@ public:
};
-#ifdef USE_HASHMAP_MEMORY_POOL
- FixedSizeMemoryPool<sizeof(Node), HASHMAP_MEMORYPOOL_SIZE> _nodePool;
+ ObjectPool<Node, HASHMAP_MEMORYPOOL_SIZE> _nodePool;
Node *allocNode(const Key &key) {
- void* mem = _nodePool.malloc();
- return new (mem) Node(key);
+ return new (_nodePool) Node(key);
}
void freeNode(Node *node) {
- node->~Node();
- _nodePool.free(node);
+ _nodePool.deleteChunk(node);
}
-#else
- Node* allocNode(const Key &key) {
- return new Node(key);
- }
-
- void freeNode(Node *node) {
- delete node;
- }
-#endif
Node **_storage; // hashtable of size arrsize.
uint _mask; /**< Capacity of the HashMap minus one; must be a power of two of minus one */