diff options
author | Benjamin Otte <otte@redhat.com> | 2011-11-19 13:18:05 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2011-11-21 22:33:45 +0100 |
commit | 769186dbffe0f472dd829e7da4b94bdece1db4ba (patch) | |
tree | 1afa59a89765b3a8001e2066e6bca4581c0f8b1b /gtk/gtkrbtree.c | |
parent | ba7a0a01887d2558ee7a2152834bd33a1f901947 (diff) | |
download | gtk+-769186dbffe0f472dd829e7da4b94bdece1db4ba.tar.gz |
rbtree: Use gtk_rbnode_adjust()
Make gtk_rbnode_remove() use it when unlinking the node.
Diffstat (limited to 'gtk/gtkrbtree.c')
-rw-r--r-- | gtk/gtkrbtree.c | 44 |
1 files changed, 3 insertions, 41 deletions
diff --git a/gtk/gtkrbtree.c b/gtk/gtkrbtree.c index b62a0f3dc1..a09db5a5b2 100644 --- a/gtk/gtkrbtree.c +++ b/gtk/gtkrbtree.c @@ -1170,30 +1170,8 @@ _gtk_rbtree_remove_node (GtkRBTree *tree, y = y->left; } - /* adjust count only beneath tree */ - for (x = y; x != tree->nil; x = x->parent) - { - x->count--; - } - - /* offsets and total count adjust all the way up through parent trees */ y_height = GTK_RBNODE_GET_HEIGHT (y); - tmp_tree = tree; - tmp_node = y; - while (tmp_tree && tmp_node && tmp_node != tmp_tree->nil) - { - tmp_node->offset -= (y_height + (y->children?y->children->root->offset:0)); - _fixup_validation (tmp_tree, tmp_node); - _fixup_total_count (tmp_tree, tmp_node); - tmp_node = tmp_node->parent; - if (tmp_node == tmp_tree->nil) - { - tmp_node = tmp_tree->parent_node; - tmp_tree = tmp_tree->parent_tree; - } - } - /* x is y's only child, or nil */ if (y->left != tree->nil) x = y->left; @@ -1216,25 +1194,9 @@ _gtk_rbtree_remove_node (GtkRBTree *tree, /* We need to clean up the validity of the tree. */ - - tmp_tree = tree; - tmp_node = x; - do - { - /* We skip the first time, iff x is nil */ - if (tmp_node != tmp_tree->nil) - { - _fixup_validation (tmp_tree, tmp_node); - _fixup_total_count (tmp_tree, tmp_node); - } - tmp_node = tmp_node->parent; - if (tmp_node == tmp_tree->nil) - { - tmp_node = tmp_tree->parent_node; - tmp_tree = tmp_tree->parent_tree; - } - } - while (tmp_tree != NULL); + gtk_rbnode_adjust (tree, y, + -1, -1, + - (y_height + (y->children?y->children->root->offset:0))); if (y != node) { |