score: Do not inline _RBTree_Find_unprotected()

This function is to big to inline.  It leads also to test case
explosion.
This commit is contained in:
Sebastian Huber
2012-12-22 17:57:07 +01:00
parent 1dbbc0c3b1
commit 53afcfd246
3 changed files with 39 additions and 34 deletions

View File

@@ -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 */
/* end of include file */

View File

@@ -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.
*

View File

@@ -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;
}