summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/rbtreeextract.c
diff options
context:
space:
mode:
authorGedare Bloom <gedare@rtems.org>2012-05-03 12:43:29 -0400
committerGedare Bloom <gedare@rtems.org>2012-05-08 18:40:44 -0400
commitf53aa8d3026eb97e3c67e44a1c931442dbc95010 (patch)
tree070391bda95c04c9a8b5d4e9489f4c0788c0e05f /cpukit/score/src/rbtreeextract.c
parentPR2061: RBTree: updating min and max on insert with duplicates (diff)
downloadrtems-f53aa8d3026eb97e3c67e44a1c931442dbc95010.tar.bz2
rbtree: API changes. Remove rbtree control node from RBTree_Next.
The implementation of RBTree_Next was using an awkward construction to detect and avoid accessing the false root of the red-black tree. To deal with the false root, RBTree_Next was comparing node parents with the control node. Instead the false root can be detected by checking if the grandparent of a node exists; the grandparent of the tree's true root is NULL by definition so the root of the tree is found while walking up the tree by checking for the non-existence of a grandparent. This change propagates into the predecessor/successor and iterate functions.
Diffstat (limited to 'cpukit/score/src/rbtreeextract.c')
-rw-r--r--cpukit/score/src/rbtreeextract.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cpukit/score/src/rbtreeextract.c b/cpukit/score/src/rbtreeextract.c
index 9a0a18bea8..e3b27fc430 100644
--- a/cpukit/score/src/rbtreeextract.c
+++ b/cpukit/score/src/rbtreeextract.c
@@ -109,7 +109,7 @@ void _RBTree_Extract_unprotected(
/* check if min needs to be updated */
if (the_node == the_rbtree->first[RBT_LEFT]) {
RBTree_Node *next;
- next = _RBTree_Successor_unprotected(the_rbtree, the_node);
+ next = _RBTree_Successor_unprotected(the_node);
the_rbtree->first[RBT_LEFT] = next;
}
@@ -117,7 +117,7 @@ void _RBTree_Extract_unprotected(
* do not use else if here. */
if (the_node == the_rbtree->first[RBT_RIGHT]) {
RBTree_Node *previous;
- previous = _RBTree_Predecessor_unprotected(the_rbtree, the_node);
+ previous = _RBTree_Predecessor_unprotected(the_node);
the_rbtree->first[RBT_RIGHT] = previous;
}