diff options
author | Benjamin Otte <otte@redhat.com> | 2011-11-19 13:08:10 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2011-11-21 22:33:45 +0100 |
commit | 7b2d414222374d1383be543271d7cc9597677bed (patch) | |
tree | 4f9deeabc8943793500d67ba10be563374f2837f /gtk/gtkrbtree.c | |
parent | 01a44e2a1658f854e860d1e20540133b2ec43722 (diff) | |
download | gtk+-7b2d414222374d1383be543271d7cc9597677bed.tar.gz |
rbtree: Use gtk_rbnode_adjust() more
Make _gtk_rbtree_insert_before() use it.
Diffstat (limited to 'gtk/gtkrbtree.c')
-rw-r--r-- | gtk/gtkrbtree.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/gtk/gtkrbtree.c b/gtk/gtkrbtree.c index ce4c385433..9f281be200 100644 --- a/gtk/gtkrbtree.c +++ b/gtk/gtkrbtree.c @@ -515,8 +515,6 @@ _gtk_rbtree_insert_before (GtkRBTree *tree, { GtkRBNode *node; gboolean left = TRUE; - GtkRBNode *tmp_node; - GtkRBTree *tmp_tree; #ifdef G_ENABLE_DEBUG if (gtk_get_debug_flags () & GTK_DEBUG_TREE) @@ -546,32 +544,15 @@ _gtk_rbtree_insert_before (GtkRBTree *tree, current->left = node; else current->right = node; - tmp_node = node->parent; - tmp_tree = tree; + gtk_rbnode_adjust (tree, node->parent, + 1, 1, height); } else { g_assert (tree->root == tree->nil); tree->root = node; - tmp_node = tree->parent_node; - tmp_tree = tree->parent_tree; - } - - while (tmp_tree && tmp_node && tmp_node != tmp_tree->nil) - { - /* We only want to propagate the count if we are in the tree we - * started in. */ - if (tmp_tree == tree) - tmp_node->count++; - - tmp_node->total_count += 1; - tmp_node->offset += height; - 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->parent_tree, tree->parent_node, + 0, 1, height); } if (valid) |