diff options
author | Johannes Schickel | 2008-03-30 02:36:23 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-03-30 02:36:23 +0000 |
commit | dcc385f3de5d3b8d520bab310836c8e58e88ad0b (patch) | |
tree | 96de7b13c33e584042fbf0132ada13525e5c0d7c /common/hashmap.h | |
parent | a957b45d5cb8c532ce3995935c6d840e36bb41dd (diff) | |
download | scummvm-rg350-dcc385f3de5d3b8d520bab310836c8e58e88ad0b.tar.gz scummvm-rg350-dcc385f3de5d3b8d520bab310836c8e58e88ad0b.tar.bz2 scummvm-rg350-dcc385f3de5d3b8d520bab310836c8e58e88ad0b.zip |
Fixed hashmap code. (please make a better check next time when changing code in common/, this was a really bad one :-/)
svn-id: r31314
Diffstat (limited to 'common/hashmap.h')
-rw-r--r-- | common/hashmap.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/common/hashmap.h b/common/hashmap.h index 1ab6bb84a3..8510fdfbbc 100644 --- a/common/hashmap.h +++ b/common/hashmap.h @@ -98,11 +98,15 @@ public: Node(const Key &key) : _key(key), _value() {} }; - Node* allocNode(const Key& key) { + Node *allocNode(const Key& key) { return new Node(key); } - void freeNode(Node* node) { + Node *allocNode(Node ©) { + return new Node(copy); + } + + void freeNode(Node *node) { delete node; } @@ -384,7 +388,7 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::assign(const HM_t& map) { _nele = 0; for (uint ctr = 0; ctr < _arrsize; ++ctr) { if (map._arr[ctr] != NULL) { - _arr[ctr] = allocNode(map._arr[ctr]->_key); + _arr[ctr] = allocNode(*map._arr[ctr]); _nele++; } } |