aboutsummaryrefslogtreecommitdiff
path: root/common/map.h
diff options
context:
space:
mode:
authorMax Horn2002-09-09 11:23:31 +0000
committerMax Horn2002-09-09 11:23:31 +0000
commit126dec89e673cd98d2ba65daeae5dd0a6e017245 (patch)
tree321b26a21fe5273c3881993b1f953013c02ab42e /common/map.h
parent7738fbde725cac83bb90535134d9a036752c7317 (diff)
downloadscummvm-rg350-126dec89e673cd98d2ba65daeae5dd0a6e017245.tar.gz
scummvm-rg350-126dec89e673cd98d2ba65daeae5dd0a6e017245.tar.bz2
scummvm-rg350-126dec89e673cd98d2ba65daeae5dd0a6e017245.zip
added missing destructor; fixed clearNodes; fixed parameter of merge()
svn-id: r4916
Diffstat (limited to 'common/map.h')
-rw-r--r--common/map.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/common/map.h b/common/map.h
index 4d3b3f26ac..5fd655093c 100644
--- a/common/map.h
+++ b/common/map.h
@@ -79,6 +79,13 @@ public:
_header = new Node();
_header->_right = _header->_left = _header;
}
+
+ ~Map<Key, Value>()
+ {
+ clearNodes(_root);
+ delete _header;
+ _root = _header = 0;
+ }
/*
* Return the object for the given key. If no match is found, a new entry
@@ -160,7 +167,7 @@ public:
delete node;
}
- void merge(Map<Key, Value> map)
+ void merge(const Map<Key, Value> &map)
{
// FIXME - this is a very bad algorithm.
// Right now we insert the items from 'map' using the default iterator,
@@ -234,8 +241,8 @@ protected:
if (!node)
return;
- clearNodes(left);
- clearNodes(right);
+ clearNodes(node->_left);
+ clearNodes(node->_right);
delete node;
}
};