[gtk+] rbtree: Use gtk_rbnode_adjust() more.



commit ba7a0a01887d2558ee7a2152834bd33a1f901947
Author: Benjamin Otte <otte redhat com>
Date:   Sat Nov 19 13:10:05 2011 +0100

    rbtree: Use gtk_rbnode_adjust() more.
    
    Make _gtk_rbtree_node_set_height() use it.

 gtk/gtkrbtree.c |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkrbtree.c b/gtk/gtkrbtree.c
index 9f281be..b62a0f3 100644
--- a/gtk/gtkrbtree.c
+++ b/gtk/gtkrbtree.c
@@ -603,22 +603,12 @@ _gtk_rbtree_node_set_height (GtkRBTree *tree,
 			     gint       height)
 {
   gint diff = height - GTK_RBNODE_GET_HEIGHT (node);
-  GtkRBNode *tmp_node = node;
-  GtkRBTree *tmp_tree = tree;
 
   if (diff == 0)
     return;
 
-  while (tmp_tree && tmp_node && tmp_node != tmp_tree->nil)
-    {
-      tmp_node->offset += diff;
-      tmp_node = tmp_node->parent;
-      if (tmp_node == tmp_tree->nil)
-	{
-	  tmp_node = tmp_tree->parent_node;
-	  tmp_tree = tmp_tree->parent_tree;
-	}
-    }
+  gtk_rbnode_adjust (tree, node, 0, 0, diff);
+
 #ifdef G_ENABLE_DEBUG  
   if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
     _gtk_rbtree_test (G_STRLOC, tree);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]