From dcc385f3de5d3b8d520bab310836c8e58e88ad0b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 30 Mar 2008 02:36:23 +0000 Subject: Fixed hashmap code. (please make a better check next time when changing code in common/, this was a really bad one :-/) svn-id: r31314 --- common/hashmap.h | 10 +++++++--- 1 file 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::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++; } } -- cgit v1.2.3