From 4459c4872ceea291ec5373d2fe8554b750d267d0 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 1 Jun 2011 22:31:16 -0400 Subject: [PATCH] Use comparison function for end/max_end Signed-off-by: Mathieu Desnoyers --- urcu-rbtree.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/urcu-rbtree.c b/urcu-rbtree.c index d225729..b2982bb 100644 --- a/urcu-rbtree.c +++ b/urcu-rbtree.c @@ -381,12 +381,16 @@ void populate_node_end(struct rcu_rbtree *rbtree, struct rcu_rbtree_node *node, assert(node); assert(!rcu_rbtree_is_nil(rbtree, node)); max_end = node->end; - if (!rcu_rbtree_is_nil(rbtree, node->_right)) - max_end = max(max_end, node->_right->max_end); - if (!rcu_rbtree_is_nil(rbtree, node->_left)) - max_end = max(max_end, node->_left->max_end); + if (!rcu_rbtree_is_nil(rbtree, node->_right)) { + if (rbtree->comp(max_end, node->_right->max_end) < 0) + max_end = node->_right->max_end; + } + if (!rcu_rbtree_is_nil(rbtree, node->_left)) { + if (rbtree->comp(max_end, node->_left->max_end) < 0) + max_end = node->_left->max_end; + } - if (max_end != node->max_end) { + if (rbtree->comp(max_end, node->max_end) != 0) { if (prev && copy_parents) { node = dup_decay_node(rbtree, node); if (get_pos(prev) == IS_RIGHT) -- 2.34.1