aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-04-28 10:23:26 +0000
committerMax Horn2009-04-28 10:23:26 +0000
commitf52a0df4223ec7d2524c273d403f12b155768d7a (patch)
treefa3813385640397ea0346378f926b99babbc9d47
parent9a971c7d80e7ef79a0a2a2d1ba99b385ff50c083 (diff)
downloadscummvm-rg350-f52a0df4223ec7d2524c273d403f12b155768d7a.tar.gz
scummvm-rg350-f52a0df4223ec7d2524c273d403f12b155768d7a.tar.bz2
scummvm-rg350-f52a0df4223ec7d2524c273d403f12b155768d7a.zip
COMMON: Made Common::List::clear more efficient
svn-id: r40172
-rw-r--r--common/list.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/common/list.h b/common/list.h
index b05a2b4e16..4b5d95df0d 100644
--- a/common/list.h
+++ b/common/list.h
@@ -192,7 +192,15 @@ public:
}
void clear() {
- erase(begin(), end());
+ NodeBase *pos = _anchor._next;
+ while (pos != &_anchor) {
+ Node *node = static_cast<Node *>(pos);
+ pos = pos->_next;
+ delete node;
+ }
+
+ _anchor._prev = &_anchor;
+ _anchor._next = &_anchor;
}
bool empty() const {