[PATCH 06/15] score: Add const to _RBTree_Find_inline()
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri May 20 13:33:43 UTC 2016
---
cpukit/score/include/rtems/score/rbtree.h | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/cpukit/score/include/rtems/score/rbtree.h b/cpukit/score/include/rtems/score/rbtree.h
index 1833483..dd56f1b 100644
--- a/cpukit/score/include/rtems/score/rbtree.h
+++ b/cpukit/score/include/rtems/score/rbtree.h
@@ -307,6 +307,16 @@ RTEMS_INLINE_ROUTINE RBTree_Node **_RBTree_Root_reference(
}
/**
+ * @brief Returns a constant reference to the root pointer of the red-black tree.
+ */
+RTEMS_INLINE_ROUTINE RBTree_Node * const *_RBTree_Root_const_reference(
+ const RBTree_Control *the_rbtree
+)
+{
+ return &RB_ROOT( the_rbtree );
+}
+
+/**
* @brief Returns a pointer to the parent of this node.
*
* The node must have a parent, thus it is invalid to use this function for the
@@ -542,17 +552,17 @@ RTEMS_INLINE_ROUTINE void _RBTree_Insert_inline(
* @retval NULL No object with the specified key exists in the red-black tree.
*/
RTEMS_INLINE_ROUTINE void *_RBTree_Find_inline(
- RBTree_Control *the_rbtree,
- const void *key,
- bool ( *equal )( const void *, const RBTree_Node * ),
- bool ( *less )( const void *, const RBTree_Node * ),
- void *( *map )( RBTree_Node * )
+ const RBTree_Control *the_rbtree,
+ const void *key,
+ bool ( *equal )( const void *, const RBTree_Node * ),
+ bool ( *less )( const void *, const RBTree_Node * ),
+ void *( *map )( RBTree_Node * )
)
{
- RBTree_Node **link;
- RBTree_Node *parent;
+ RBTree_Node * const *link;
+ RBTree_Node *parent;
- link = _RBTree_Root_reference( the_rbtree );
+ link = _RBTree_Root_const_reference( the_rbtree );
parent = NULL;
while ( *link != NULL ) {
--
1.8.4.5
More information about the devel
mailing list