[llvm-commits] [poolalloc] r57647 - /poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h

Andrew Lenharth alenhar2 at cs.uiuc.edu
Thu Oct 16 11:11:08 PDT 2008


Author: alenhar2
Date: Thu Oct 16 13:11:06 2008
New Revision: 57647

URL: http://llvm.org/viewvc/llvm-project?rev=57647&view=rev
Log:
splay free version of delete

Modified:
    poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h

Modified: poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h?rev=57647&r1=57646&r2=57647&view=diff

==============================================================================
--- poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h (original)
+++ poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h Thu Oct 16 13:11:06 2008
@@ -86,6 +86,13 @@
     return 0;
   }
 
+  void __clear_internal(tree_node* t) {
+    if (!t) return;
+    __clear_internal(t->left);
+    __clear_internal(t->right);
+    delete t;
+  }
+
  protected:
 
   RangeSplayTree() : Tree(0) {}
@@ -140,8 +147,8 @@
   }
 
   void __clear() {
-    while (Tree)
-      __remove (Tree->start);
+    __clear_internal(Tree);
+    Tree = 0;
   }
 
   tree_node* __find(void* key) {





More information about the llvm-commits mailing list