- if (_gtk_rbtree_is_nil (node))
- return;
-
- node->total_count = 1;
-
- if (!_gtk_rbtree_is_nil (node->left))
- {
- gtk_rbtree_reorder_fixup (tree, node->left);
- node->offset += node->left->offset;
- node->total_count += node->left->total_count;
- }
- if (!_gtk_rbtree_is_nil (node->right))
- {
- gtk_rbtree_reorder_fixup (tree, node->right);
- node->offset += node->right->offset;
- node->total_count += node->right->total_count;
- }
-
- if (node->children)
- {
- node->offset += node->children->root->offset;
- node->total_count += node->children->root->total_count;
- }
-
- if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) ||
- (!_gtk_rbtree_is_nil (node->right) && GTK_RBNODE_FLAG_SET (node->right, GTK_RBNODE_DESCENDANTS_INVALID)) ||
- (!_gtk_rbtree_is_nil (node->left) && GTK_RBNODE_FLAG_SET (node->left, GTK_RBNODE_DESCENDANTS_INVALID)) ||
- (node->children && GTK_RBNODE_FLAG_SET (node->children->root, GTK_RBNODE_DESCENDANTS_INVALID)))
- GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_DESCENDANTS_INVALID);
- else
- GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_DESCENDANTS_INVALID);
+ to->flags = (to->flags & GTK_RBNODE_NON_COLORS) | GTK_RBNODE_GET_COLOR (from);
+
+ to->left = from->left;
+ if (!_gtk_rbtree_is_nil (to->left))
+ to->left->parent = to;
+
+ to->right = from->right;
+ if (!_gtk_rbtree_is_nil (to->right))
+ to->right->parent = to;
+
+ to->parent = from->parent;
+ if (_gtk_rbtree_is_nil (to->parent))
+ tree->root = to;
+ else if (to->parent->left == from)
+ to->parent->left = to;
+ else if (to->parent->right == from)
+ to->parent->right = to;