BIND 10 trac2750, updated. 313c564232efbcfc2cc8d34593ce9494ba96d629 [2750] Fix overall loop condition in removeRebalance()

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Sep 2 10:25:29 UTC 2013


The branch, trac2750 has been updated
       via  313c564232efbcfc2cc8d34593ce9494ba96d629 (commit)
      from  8a4c8c4fec6d869d9ecbbbab9c0374658cfd7a99 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 313c564232efbcfc2cc8d34593ce9494ba96d629
Author: Mukund Sivaraman <muks at isc.org>
Date:   Mon Sep 2 15:55:03 2013 +0530

    [2750] Fix overall loop condition in removeRebalance()
    
    It needs to check at the upper node if child is NULL!

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/memory/domaintree.h |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/domaintree.h b/src/lib/datasrc/memory/domaintree.h
index faf4424..875ab26 100644
--- a/src/lib/datasrc/memory/domaintree.h
+++ b/src/lib/datasrc/memory/domaintree.h
@@ -1728,7 +1728,7 @@ private:
 
     void
     removeRebalance(typename DomainTreeNode<T>::DomainTreeNodePtr* root_ptr,
-                    DomainTreeNode<T>* child);
+                    DomainTreeNode<T>* child, DomainTreeNode<T>* parent);
 
     DomainTreeNode<T>*
     rightRotate(typename DomainTreeNode<T>::DomainTreeNodePtr* root,
@@ -2349,7 +2349,7 @@ DomainTree<T>::remove(util::MemorySegment& mem_sgmt, DomainTreeNode<T>* node,
             // red-black tree again.
             typename DomainTreeNode<T>::DomainTreeNodePtr* root_ptr =
                 upper_node ? &(upper_node->down_) : &root_;
-            removeRebalance(root_ptr, child);
+            removeRebalance(root_ptr, child, node->getParent());
         }
     }
 
@@ -2672,13 +2672,11 @@ template <typename T>
 void
 DomainTree<T>::removeRebalance
     (typename DomainTreeNode<T>::DomainTreeNodePtr* root_ptr,
-     DomainTreeNode<T>* child)
+     DomainTreeNode<T>* child,  DomainTreeNode<T>* parent)
 {
     // Case 1. Repeat until we reach the root node of this subtree in
     // the forest.
-    while (child && (!child->isSubTreeRoot())) {
-        DomainTreeNode<T>* parent = child->getParent();
-
+    while (&(parent->down_) != root_ptr) {
         // A sibling node is defined as the parent's other child. It
         // exists at the same level as child. Note that child can be
         // NULL here.
@@ -2786,6 +2784,7 @@ DomainTree<T>::removeRebalance
 
             if (parent->isBlack()) {
                 child = parent;
+                parent = parent->getParent();
                 continue;
             } else {
                 parent->setColor(DomainTreeNode<T>::BLACK);



More information about the bind10-changes mailing list