From 53afcfd24613d8e485f3534fae96be10e7e1293a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Sat, 22 Dec 2012 17:57:07 +0100 Subject: score: Do not inline _RBTree_Find_unprotected() This function is to big to inline. It leads also to test case explosion. --- cpukit/score/include/rtems/score/rbtree.h | 16 ++++++++++++++- cpukit/score/inline/rtems/score/rbtree.inl | 33 ------------------------------ cpukit/score/src/rbtreefind.c | 24 ++++++++++++++++++++++ 3 files changed, 39 insertions(+), 34 deletions(-) diff --git a/cpukit/score/include/rtems/score/rbtree.h b/cpukit/score/include/rtems/score/rbtree.h index 3ce9226bc0..db26e59a96 100644 --- a/cpukit/score/include/rtems/score/rbtree.h +++ b/cpukit/score/include/rtems/score/rbtree.h @@ -224,6 +224,20 @@ RBTree_Node *_RBTree_Get( RBTree_Direction dir ); +/** @brief Find the node with given key in the tree + * + * This function returns a pointer to the node in @a the_rbtree + * having key equal to key of @a the_node if it exists, + * and NULL if not. @a the_node has to be made up before a search. + * + * @note If the tree is not unique and contains duplicate keys, the set + * of duplicate keys acts as FIFO. + */ +RBTree_Node *_RBTree_Find_unprotected( + RBTree_Control *the_rbtree, + RBTree_Node *the_node +); + /** * @brief Find the node with given key in the tree. * @@ -393,4 +407,4 @@ void _RBTree_Iterate_unprotected( /**@}*/ #endif -/* end of include file */ \ No newline at end of file +/* end of include file */ diff --git a/cpukit/score/inline/rtems/score/rbtree.inl b/cpukit/score/inline/rtems/score/rbtree.inl index 439b40a0ba..e25e3df289 100644 --- a/cpukit/score/inline/rtems/score/rbtree.inl +++ b/cpukit/score/inline/rtems/score/rbtree.inl @@ -341,39 +341,6 @@ RTEMS_INLINE_ROUTINE bool _RBTree_Is_lesser( return compare_result < 0; } -/** @brief Find the node with given key in the tree - * - * This function returns a pointer to the node in @a the_rbtree - * having key equal to key of @a the_node if it exists, - * and NULL if not. @a the_node has to be made up before a search. - * - * @note If the tree is not unique and contains duplicate keys, the set - * of duplicate keys acts as FIFO. - */ -RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Find_unprotected( - RBTree_Control *the_rbtree, - RBTree_Node *the_node - ) -{ - RBTree_Node* iter_node = the_rbtree->root; - RBTree_Node* found = NULL; - int compare_result; - while (iter_node) { - compare_result = the_rbtree->compare_function(the_node, iter_node); - if ( _RBTree_Is_equal( compare_result ) ) { - found = iter_node; - if ( the_rbtree->is_unique ) - break; - } - - RBTree_Direction dir = - (RBTree_Direction) _RBTree_Is_greater( compare_result ); - iter_node = iter_node->child[dir]; - } /* while(iter_node) */ - - return found; -} - /** * @brief Returns the predecessor of a node. * diff --git a/cpukit/score/src/rbtreefind.c b/cpukit/score/src/rbtreefind.c index 2e8cdc3bff..3f205ab391 100644 --- a/cpukit/score/src/rbtreefind.c +++ b/cpukit/score/src/rbtreefind.c @@ -36,3 +36,27 @@ RBTree_Node *_RBTree_Find( _ISR_Enable( level ); return return_node; } + +RBTree_Node *_RBTree_Find_unprotected( + RBTree_Control *the_rbtree, + RBTree_Node *the_node +) +{ + RBTree_Node* iter_node = the_rbtree->root; + RBTree_Node* found = NULL; + int compare_result; + while (iter_node) { + compare_result = the_rbtree->compare_function(the_node, iter_node); + if ( _RBTree_Is_equal( compare_result ) ) { + found = iter_node; + if ( the_rbtree->is_unique ) + break; + } + + RBTree_Direction dir = + (RBTree_Direction) _RBTree_Is_greater( compare_result ); + iter_node = iter_node->child[dir]; + } /* while(iter_node) */ + + return found; +} -- cgit v1.2.3