diff options
Diffstat (limited to 'cpukit/include/rtems/score/rbtree.h')
-rw-r--r-- | cpukit/include/rtems/score/rbtree.h | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/cpukit/include/rtems/score/rbtree.h b/cpukit/include/rtems/score/rbtree.h index 6b0674eecc..253ef296bc 100644 --- a/cpukit/include/rtems/score/rbtree.h +++ b/cpukit/include/rtems/score/rbtree.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -11,9 +13,26 @@ /* * Copyright (c) 2010 Gedare Bloom. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RTEMS_SCORE_RBTREE_H @@ -84,7 +103,7 @@ typedef RB_HEAD(RBTree_Control, RBTree_Node) RBTree_Control; * * @see _RBTree_Is_node_off_tree(). */ -RTEMS_INLINE_ROUTINE void _RBTree_Set_off_tree( RBTree_Node *the_node ) +static inline void _RBTree_Set_off_tree( RBTree_Node *the_node ) { RB_COLOR( the_node, Node ) = -1; } @@ -99,7 +118,7 @@ RTEMS_INLINE_ROUTINE void _RBTree_Set_off_tree( RBTree_Node *the_node ) * * @see _RBTree_Set_off_tree(). */ -RTEMS_INLINE_ROUTINE bool _RBTree_Is_node_off_tree( +static inline bool _RBTree_Is_node_off_tree( const RBTree_Node *the_node ) { @@ -125,7 +144,7 @@ void _RBTree_Insert_color( * * @param[out] the_node The red-black tree node to initialize. */ -RTEMS_INLINE_ROUTINE void _RBTree_Initialize_node( RBTree_Node *the_node ) +static inline void _RBTree_Initialize_node( RBTree_Node *the_node ) { #if defined(RTEMS_DEBUG) _RBTree_Set_off_tree( the_node ); @@ -141,7 +160,7 @@ RTEMS_INLINE_ROUTINE void _RBTree_Initialize_node( RBTree_Node *the_node ) * @param[out] parent The parent node. * @param[out] link The child node link of the parent node. */ -RTEMS_INLINE_ROUTINE void _RBTree_Add_child( +static inline void _RBTree_Add_child( RBTree_Node *child, RBTree_Node *parent, RBTree_Node **link @@ -202,7 +221,7 @@ RTEMS_INLINE_ROUTINE void _RBTree_Add_child( * } * @endcode */ -RTEMS_INLINE_ROUTINE void _RBTree_Insert_with_parent( +static inline void _RBTree_Insert_with_parent( RBTree_Control *the_rbtree, RBTree_Node *the_node, RBTree_Node *parent, @@ -242,7 +261,7 @@ void _RBTree_Extract( * * @see _RBTree_Is_root(). */ -RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Root( +static inline RBTree_Node *_RBTree_Root( const RBTree_Control *the_rbtree ) { @@ -257,7 +276,7 @@ RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Root( * @retval pointer Pointer to the root node. * @retval NULL The tree is empty. */ -RTEMS_INLINE_ROUTINE RBTree_Node **_RBTree_Root_reference( +static inline RBTree_Node **_RBTree_Root_reference( RBTree_Control *the_rbtree ) { @@ -272,7 +291,7 @@ RTEMS_INLINE_ROUTINE RBTree_Node **_RBTree_Root_reference( * @retval pointer Pointer to the root node. * @retval NULL The tree is empty. */ -RTEMS_INLINE_ROUTINE RBTree_Node * const *_RBTree_Root_const_reference( +static inline RBTree_Node * const *_RBTree_Root_const_reference( const RBTree_Control *the_rbtree ) { @@ -291,7 +310,7 @@ RTEMS_INLINE_ROUTINE RBTree_Node * const *_RBTree_Root_const_reference( * @retval parent The parent of this node. * @retval undefined The node is the root node or not part of a tree. */ -RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Parent( +static inline RBTree_Node *_RBTree_Parent( const RBTree_Node *the_node ) { @@ -307,7 +326,7 @@ RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Parent( * * @return This method returns the left node on the rbtree. */ -RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Left( +static inline RBTree_Node *_RBTree_Left( const RBTree_Node *the_node ) { @@ -322,7 +341,7 @@ RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Left( * * @return This method returns a reference to the left child pointer on the rbtree. */ -RTEMS_INLINE_ROUTINE RBTree_Node **_RBTree_Left_reference( +static inline RBTree_Node **_RBTree_Left_reference( RBTree_Node *the_node ) { @@ -338,7 +357,7 @@ RTEMS_INLINE_ROUTINE RBTree_Node **_RBTree_Left_reference( * * @return This method returns the right node on the rbtree. */ -RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Right( +static inline RBTree_Node *_RBTree_Right( const RBTree_Node *the_node ) { @@ -353,7 +372,7 @@ RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Right( * * @return This method returns a reference to the right child pointer on the rbtree. */ -RTEMS_INLINE_ROUTINE RBTree_Node **_RBTree_Right_reference( +static inline RBTree_Node **_RBTree_Right_reference( RBTree_Node *the_node ) { @@ -371,7 +390,7 @@ RTEMS_INLINE_ROUTINE RBTree_Node **_RBTree_Right_reference( * @retval true There are no nodes on @a the_rbtree. * @retval false There are nodes on @a the_rbtree. */ -RTEMS_INLINE_ROUTINE bool _RBTree_Is_empty( +static inline bool _RBTree_Is_empty( const RBTree_Control *the_rbtree ) { @@ -392,7 +411,7 @@ RTEMS_INLINE_ROUTINE bool _RBTree_Is_empty( * * @see _RBTree_Root(). */ -RTEMS_INLINE_ROUTINE bool _RBTree_Is_root( +static inline bool _RBTree_Is_root( const RBTree_Node *the_node ) { @@ -406,7 +425,7 @@ RTEMS_INLINE_ROUTINE bool _RBTree_Is_root( * * @param[out] the_rbtree The rbtree to initialize. */ -RTEMS_INLINE_ROUTINE void _RBTree_Initialize_empty( +static inline void _RBTree_Initialize_empty( RBTree_Control *the_rbtree ) { @@ -420,7 +439,7 @@ RTEMS_INLINE_ROUTINE void _RBTree_Initialize_empty( * @param[out] the_rbtree The red-black tree control. * @param[out] the_node The one and only node. */ -RTEMS_INLINE_ROUTINE void _RBTree_Initialize_one( +static inline void _RBTree_Initialize_one( RBTree_Control *the_rbtree, RBTree_Node *the_node ) @@ -504,7 +523,7 @@ void _RBTree_Replace_node( * @retval false The inserted node is not the new minimum node according to the * specified less order function. */ -RTEMS_INLINE_ROUTINE bool _RBTree_Insert_inline( +static inline bool _RBTree_Insert_inline( RBTree_Control *the_rbtree, RBTree_Node *the_node, const void *key, @@ -553,7 +572,7 @@ RTEMS_INLINE_ROUTINE bool _RBTree_Insert_inline( * @retval object An object with the specified key. * @retval NULL No object with the specified key exists in the red-black tree. */ -RTEMS_INLINE_ROUTINE void *_RBTree_Find_inline( +static inline void *_RBTree_Find_inline( const RBTree_Control *the_rbtree, const void *key, bool ( *equal )( const void *, const RBTree_Node * ), |