rbtree: Use gtk_rbnode_adjust()

Make _gtk_rbtree_insert_after() use it.
This commit is contained in:
Benjamin Otte 2011-11-19 13:06:22 +01:00
parent 22a4c15b4f
commit 01a44e2a16

View File

@ -448,8 +448,6 @@ _gtk_rbtree_insert_after (GtkRBTree *tree,
{
GtkRBNode *node;
gboolean right = TRUE;
GtkRBNode *tmp_node;
GtkRBTree *tmp_tree;
#ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
@ -478,32 +476,15 @@ _gtk_rbtree_insert_after (GtkRBTree *tree,
current->right = node;
else
current->left = 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)