• R/O
  • SSH
  • HTTPS

eirrepo: Commit


Commit MetaInfo

Revision100 (tree)
Time2018-05-13 22:01:57
Authorquiret

Log Message

- another fix over the same code-location, fixing the issue for good

Change Summary

Incremental Difference

--- common/sdk/AVLTree.h (revision 99)
+++ common/sdk/AVLTree.h (revision 100)
@@ -493,14 +493,11 @@
493493 }
494494 }
495495
496- AINLINE void remove_node( AVLNode *node, AVLNode **nodePtr, AVLNode *parent )
496+ AINLINE void remove_node( AVLNode *node, AVLNode **nodePtr, AVLNode *leftChild, AVLNode *rightChild, AVLNode *parent )
497497 {
498498 // We assume that node is NOT part of a nodestack!
499499 assert( parent != node );
500500
501- AVLNode *leftChild = node->left;
502- AVLNode *rightChild = node->right;
503-
504501 // If we have a nodestack, then we just shedule the first member of the nodestack to be new member of the AVL tree.
505502 if ( AVLNode *new_node = node->owned_nodestack )
506503 {
@@ -544,21 +541,9 @@
544541
545542 // Remove the closest node.
546543 // We know that the node has no right child, because it is the maximum in its subtree.
547- {
548- AVLNode *leftChildForReplacing = closestReplacement->left;
544+ // But since remove_node has become pretty complicated we rather stick to a call of itself :/
545+ remove_node( closestReplacement, closestReplacementPtr, closestReplacement->left, nullptr, closestReplacement->parent );
549546
550- *closestReplacementPtr = leftChildForReplacing;
551-
552- AVLNode *closestReplacementParent = closestReplacement->parent;
553-
554- if ( leftChildForReplacing != nullptr )
555- {
556- leftChildForReplacing->parent = closestReplacementParent;
557- }
558-
559- update_invalidated_tree_height( closestReplacementParent );
560- }
561-
562547 // We need to update members because they could be out-of-date.
563548 parent = node->parent;
564549 leftChild = node->left;
@@ -630,7 +615,7 @@
630615 {
631616 AVLNode **iterPtr = get_node_src_ptr( parent, node );
632617
633- remove_node( node, iterPtr, parent );
618+ remove_node( node, iterPtr, node->left, node->right, parent );
634619 }
635620 }
636621
@@ -677,7 +662,7 @@
677662 }
678663 }
679664
680- remove_node( node, iterPtr, parent );
665+ remove_node( node, iterPtr, node->left, node->right, parent );
681666
682667 return true;
683668 }
Show on old repository browser