summaryrefslogtreecommitdiff
path: root/gtk/gtkrbtree.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2020-03-05 06:51:32 +0100
committerBenjamin Otte <otte@redhat.com>2020-03-05 07:59:05 +0100
commit9fedcec82eaf762648d094f4974f60c44820326a (patch)
treea7292a79c3954f6bf80cbfde6589e562324f29f4 /gtk/gtkrbtree.c
parentf6b11a51581cf443208db5a861b63c9e9bc5e384 (diff)
downloadgtk+-9fedcec82eaf762648d094f4974f60c44820326a.tar.gz
rbtree: Simplify code
This makes it easier to understand for gcc (and hopefully humans, too) that by rotating we essentially just swap `node` and `p`.
Diffstat (limited to 'gtk/gtkrbtree.c')
-rw-r--r--gtk/gtkrbtree.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/gtk/gtkrbtree.c b/gtk/gtkrbtree.c
index 219222b1e8..55914d7cb6 100644
--- a/gtk/gtkrbtree.c
+++ b/gtk/gtkrbtree.c
@@ -381,10 +381,9 @@ gtk_rb_tree_insert_fixup (GtkRbTree *tree,
if (node == p->right)
{
/* make node a left child */
- node = p;
- gtk_rb_node_rotate_left (tree, node);
- p = parent (node);
- pp = parent (p);
+ gtk_rb_node_rotate_left (tree, p);
+ p = node;
+ node = p->left;
}
/* recolor and rotate */
set_black (p);
@@ -410,10 +409,9 @@ gtk_rb_tree_insert_fixup (GtkRbTree *tree,
/* uncle is black */
if (node == p->left)
{
- node = p;
- gtk_rb_node_rotate_right (tree, node);
- p = parent (node);
- pp = parent (p);
+ gtk_rb_node_rotate_right (tree, p);
+ p = node;
+ node = p->right;
}
set_black (p);
set_red (pp);