summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/rbtree.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-07-22 19:42:54 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-07-29 14:05:08 +0200
commit6e93c836e26c28a01e2e6c4a14470b93aed03999 (patch)
tree57a3fc35c5e0b28ef8fb49061d0d8ff04c318690 /cpukit/score/include/rtems/score/rbtree.h
parentDelete unused *_Is_null() functions (diff)
downloadrtems-6e93c836e26c28a01e2e6c4a14470b93aed03999.tar.bz2
rbtree: Simplify off-tree handling
Only use the parent pointer, since this pointer is never NULL for nodes which are part of a tree. Rename functions from *_off_rbtree() to *_off_tree().
Diffstat (limited to 'cpukit/score/include/rtems/score/rbtree.h')
-rw-r--r--cpukit/score/include/rtems/score/rbtree.h37
1 files changed, 20 insertions, 17 deletions
diff --git a/cpukit/score/include/rtems/score/rbtree.h b/cpukit/score/include/rtems/score/rbtree.h
index 2ec77ead4f..94c8ee567e 100644
--- a/cpukit/score/include/rtems/score/rbtree.h
+++ b/cpukit/score/include/rtems/score/rbtree.h
@@ -245,7 +245,7 @@ RBTree_Node *_RBTree_Insert(
* @brief Extracts (removes) the node from the red-black tree.
*
* This function does not set the node off-tree. In case this is desired, then
- * call _RBTree_Set_off_rbtree() after the extraction.
+ * call _RBTree_Set_off_tree() after the extraction.
*
* In case the node to extract is not a node of the tree, then this function
* yields unpredictable results.
@@ -273,32 +273,35 @@ RBTree_Node *_RBTree_Next(
);
/**
- * @brief Set off RBtree.
+ * @brief Sets a red-black tree node as off-tree.
*
- * This function sets the parent and child fields of the @a node to NULL
- * indicating the @a node is not part of a rbtree.
+ * Do not use this function on nodes which are a part of a tree.
*
+ * @param[in] the_node The node to set off-tree.
+ *
+ * @see _RBTree_Is_node_off_tree().
*/
-RTEMS_INLINE_ROUTINE void _RBTree_Set_off_rbtree(
- RBTree_Node *node
- )
+RTEMS_INLINE_ROUTINE void _RBTree_Set_off_tree( RBTree_Node *the_node )
{
- node->parent = node->child[RBT_LEFT] = node->child[RBT_RIGHT] = NULL;
+ the_node->parent = NULL;
}
/**
- * @brief Is the node off RBTree.
+ * @brief Returns true, if this red-black tree node is off-tree, and false
+ * otherwise.
+ *
+ * @param[in] the_node The node to test.
+ *
+ * @retval true The node is not a part of a tree (off-tree).
+ * @retval false Otherwise.
*
- * This function returns true if the @a node is not on a rbtree. A @a node is
- * off rbtree if the parent and child fields are set to NULL.
+ * @see _RBTree_Set_off_tree().
*/
-RTEMS_INLINE_ROUTINE bool _RBTree_Is_node_off_rbtree(
- const RBTree_Node *node
- )
+RTEMS_INLINE_ROUTINE bool _RBTree_Is_node_off_tree(
+ const RBTree_Node *the_node
+)
{
- return (node->parent == NULL) &&
- (node->child[RBT_LEFT] == NULL) &&
- (node->child[RBT_RIGHT] == NULL);
+ return the_node->parent == NULL;
}
/**