COMMON: Fix compilation when USE_HASHMAP_MEMORY_POOL is not defined.
This commit is contained in:
parent
0b1cb0ebbb
commit
7e4224e52a
7 changed files with 17 additions and 1 deletions
|
@ -23,6 +23,7 @@
|
|||
#include "common/debug-channels.h"
|
||||
#include "common/system.h"
|
||||
#include "common/textconsole.h"
|
||||
#include "common/algorithm.h"
|
||||
|
||||
#include <stdarg.h> // For va_list etc.
|
||||
|
||||
|
|
|
@ -106,8 +106,9 @@ private:
|
|||
HASHMAP_MEMORYPOOL_SIZE = HASHMAP_MIN_CAPACITY * HASHMAP_LOADFACTOR_NUMERATOR / HASHMAP_LOADFACTOR_DENOMINATOR
|
||||
};
|
||||
|
||||
|
||||
#ifdef USE_HASHMAP_MEMORY_POOL
|
||||
ObjectPool<Node, HASHMAP_MEMORYPOOL_SIZE> _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);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "common/hashmap.h"
|
||||
#include "common/hash-str.h"
|
||||
#include "common/stack.h"
|
||||
#include "common/memorypool.h"
|
||||
|
||||
|
||||
namespace Common {
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "lastexpress/data/archive.h"
|
||||
#include "lastexpress/shared.h"
|
||||
|
||||
#include "common/array.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
class Background;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "common/hashmap.h"
|
||||
#include "common/hash-str.h"
|
||||
#include "common/stream.h"
|
||||
#include "common/array.h"
|
||||
|
||||
#include "graphics/surface.h"
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "common/ptr.h"
|
||||
#include "common/hashmap.h"
|
||||
#include "common/hash-str.h"
|
||||
#include "common/array.h"
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "common/rect.h"
|
||||
#include "common/stream.h"
|
||||
#include "common/textconsole.h"
|
||||
#include "common/array.h"
|
||||
|
||||
namespace Video {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue