[Scummvm-cvs-logs] SF.net SVN: scummvm:[40172] scummvm/trunk/common/list.h

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Apr 28 12:23:26 CEST 2009


Revision: 40172
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40172&view=rev
Author:   fingolfin
Date:     2009-04-28 10:23:26 +0000 (Tue, 28 Apr 2009)

Log Message:
-----------
COMMON: Made Common::List::clear more efficient

Modified Paths:
--------------
    scummvm/trunk/common/list.h

Modified: scummvm/trunk/common/list.h
===================================================================
--- scummvm/trunk/common/list.h	2009-04-28 10:23:08 UTC (rev 40171)
+++ scummvm/trunk/common/list.h	2009-04-28 10:23:26 UTC (rev 40172)
@@ -192,7 +192,15 @@
 	}
 
 	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 {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list