4.115
Last change
on this file since 53afcfd2 was
53afcfd2,
checked in by Sebastian Huber <sebastian.huber@…>, on 12/22/12 at 16:57:07
|
score: Do not inline _RBTree_Find_unprotected()
This function is to big to inline. It leads also to test case
explosion.
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Find the control structure of the tree containing the given node |
---|
5 | * @ingroup ScoreRBTree |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * Copyright (c) 2010 Gedare Bloom. |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.com/license/LICENSE. |
---|
14 | */ |
---|
15 | |
---|
16 | #if HAVE_CONFIG_H |
---|
17 | #include "config.h" |
---|
18 | #endif |
---|
19 | |
---|
20 | #include <rtems/system.h> |
---|
21 | #include <rtems/score/address.h> |
---|
22 | #include <rtems/score/rbtree.h> |
---|
23 | #include <rtems/score/isr.h> |
---|
24 | |
---|
25 | RBTree_Node *_RBTree_Find( |
---|
26 | RBTree_Control *the_rbtree, |
---|
27 | RBTree_Node *search_node |
---|
28 | ) |
---|
29 | { |
---|
30 | ISR_Level level; |
---|
31 | RBTree_Node *return_node; |
---|
32 | |
---|
33 | return_node = NULL; |
---|
34 | _ISR_Disable( level ); |
---|
35 | return_node = _RBTree_Find_unprotected( the_rbtree, search_node ); |
---|
36 | _ISR_Enable( level ); |
---|
37 | return return_node; |
---|
38 | } |
---|
39 | |
---|
40 | RBTree_Node *_RBTree_Find_unprotected( |
---|
41 | RBTree_Control *the_rbtree, |
---|
42 | RBTree_Node *the_node |
---|
43 | ) |
---|
44 | { |
---|
45 | RBTree_Node* iter_node = the_rbtree->root; |
---|
46 | RBTree_Node* found = NULL; |
---|
47 | int compare_result; |
---|
48 | while (iter_node) { |
---|
49 | compare_result = the_rbtree->compare_function(the_node, iter_node); |
---|
50 | if ( _RBTree_Is_equal( compare_result ) ) { |
---|
51 | found = iter_node; |
---|
52 | if ( the_rbtree->is_unique ) |
---|
53 | break; |
---|
54 | } |
---|
55 | |
---|
56 | RBTree_Direction dir = |
---|
57 | (RBTree_Direction) _RBTree_Is_greater( compare_result ); |
---|
58 | iter_node = iter_node->child[dir]; |
---|
59 | } /* while(iter_node) */ |
---|
60 | |
---|
61 | return found; |
---|
62 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.