From c8e2cd27e9c6b6cb558121636d31a60d4d37edb5 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 7 Jul 2011 08:47:25 +0200 Subject: [PATCH] treeview: Remove special cases when computing parity The parity of the nil npode is always 0, so no need to check for the nil node first. --- gtk/gtkrbtree.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gtk/gtkrbtree.c b/gtk/gtkrbtree.c index b351eb7fc3..a912530779 100644 --- a/gtk/gtkrbtree.c +++ b/gtk/gtkrbtree.c @@ -1489,9 +1489,8 @@ void _fixup_parity (GtkRBTree *tree, GtkRBNode *node) { node->parity = 1 + - ((node->children != NULL && node->children->root != node->children->nil) ? node->children->root->parity : 0) + - ((node->left != tree->nil) ? node->left->parity : 0) + - ((node->right != tree->nil) ? node->right->parity : 0); + (node->children != NULL ? node->children->root->parity : 0) + + node->left->parity + node->right->parity; } #ifdef G_ENABLE_DEBUG