From: Mathieu Desnoyers Date: Thu, 2 Jun 2011 02:31:16 +0000 (-0400) Subject: Use comparison function for end/max_end X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4459c4872ceea291ec5373d2fe8554b750d267d0;p=urcu.git Use comparison function for end/max_end Signed-off-by: Mathieu Desnoyers --- 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)