diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-08-21 05:24:17 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-08-31 09:59:42 +0200 |
commit | 2d48456ef55717224065d21c6c3b837c816a69c1 (patch) | |
tree | 9b2d7a4d9894280bfb2fee6e9fedd1b3c99e0560 | |
parent | rbtree: Delete _RBTree_Is_first() (diff) | |
download | rtems-2d48456ef55717224065d21c6c3b837c816a69c1.tar.bz2 |
rbheap: Drop direction from _RBTree_Iterate()
-rw-r--r-- | cpukit/libcsupport/src/resource_snapshot.c | 3 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/rbtreeimpl.h | 4 | ||||
-rw-r--r-- | cpukit/score/src/rbtreeiterate.c | 8 | ||||
-rw-r--r-- | testsuites/libtests/rbheap01/init.c | 2 | ||||
-rw-r--r-- | testsuites/sptests/sprbtree01/init.c | 7 |
5 files changed, 6 insertions, 18 deletions
diff --git a/cpukit/libcsupport/src/resource_snapshot.c b/cpukit/libcsupport/src/resource_snapshot.c index 5475139535..d6f2e4606e 100644 --- a/cpukit/libcsupport/src/resource_snapshot.c +++ b/cpukit/libcsupport/src/resource_snapshot.c @@ -107,14 +107,12 @@ static void get_heap_info(Heap_Control *heap, Heap_Information_block *info) static bool count_posix_key_value_pairs( const RBTree_Node *node, - RBTree_Direction dir, void *visitor_arg ) { uint32_t *count = visitor_arg; (void) node; - (void) dir; ++(*count); @@ -128,7 +126,6 @@ static uint32_t get_active_posix_key_value_pairs(void) _Thread_Disable_dispatch(); _RBTree_Iterate( &_POSIX_Keys_Key_value_lookup_tree, - RBT_LEFT, count_posix_key_value_pairs, &count ); diff --git a/cpukit/score/include/rtems/score/rbtreeimpl.h b/cpukit/score/include/rtems/score/rbtreeimpl.h index ed4cbd558a..607e7ebf84 100644 --- a/cpukit/score/include/rtems/score/rbtreeimpl.h +++ b/cpukit/score/include/rtems/score/rbtreeimpl.h @@ -37,7 +37,6 @@ extern "C" { * @brief Red-black tree visitor. * * @param[in] node The node. - * @param[in] dir The direction. * @param[in] visitor_arg The visitor argument. * * @retval true Stop the iteration. @@ -47,7 +46,6 @@ extern "C" { */ typedef bool (*RBTree_Visitor)( const RBTree_Node *node, - RBTree_Direction dir, void *visitor_arg ); @@ -55,13 +53,11 @@ typedef bool (*RBTree_Visitor)( * @brief Red-black tree iteration. * * @param[in] rbtree The red-black tree. - * @param[in] dir The direction. * @param[in] visitor The visitor. * @param[in] visitor_arg The visitor argument. */ void _RBTree_Iterate( const RBTree_Control *rbtree, - RBTree_Direction dir, RBTree_Visitor visitor, void *visitor_arg ); diff --git a/cpukit/score/src/rbtreeiterate.c b/cpukit/score/src/rbtreeiterate.c index 8b5da1ea9f..46a0e43fcd 100644 --- a/cpukit/score/src/rbtreeiterate.c +++ b/cpukit/score/src/rbtreeiterate.c @@ -28,18 +28,16 @@ void _RBTree_Iterate( const RBTree_Control *rbtree, - RBTree_Direction dir, RBTree_Visitor visitor, void *visitor_arg ) { - RBTree_Direction opp_dir = _RBTree_Opposite_direction( dir ); - const RBTree_Node *current = _RBTree_First( rbtree, opp_dir ); + const RBTree_Node *current = _RBTree_Minimum( rbtree ); bool stop = false; while ( !stop && current != NULL ) { - stop = ( *visitor )( current, dir, visitor_arg ); + stop = ( *visitor )( current, visitor_arg ); - current = _RBTree_Next( current, dir ); + current = _RBTree_Successor( current ); } } diff --git a/testsuites/libtests/rbheap01/init.c b/testsuites/libtests/rbheap01/init.c index 6fd86db385..11a9f543de 100644 --- a/testsuites/libtests/rbheap01/init.c +++ b/testsuites/libtests/rbheap01/init.c @@ -75,7 +75,6 @@ typedef struct { static bool chunk_visitor( const RBTree_Node *node, - RBTree_Direction dir, void *visitor_arg ) { @@ -175,7 +174,6 @@ static void test_chunk_tree( _RBTree_Iterate( &control->chunk_tree, - RBT_RIGHT, chunk_visitor, &context ); diff --git a/testsuites/sptests/sprbtree01/init.c b/testsuites/sptests/sprbtree01/init.c index 102b6c43a6..c24d6483bb 100644 --- a/testsuites/sptests/sprbtree01/init.c +++ b/testsuites/sptests/sprbtree01/init.c @@ -814,7 +814,6 @@ typedef struct { static bool visit_nodes( const RBTree_Node *node, - RBTree_Direction dir, void *visitor_arg ) { @@ -1655,7 +1654,7 @@ static void random_ops( size_t n, bool unique ) v = simple_random( v ); } - _RBTree_Iterate( &tree, RBT_RIGHT, visit_nodes, &ctx ); + _RBTree_Iterate( &tree, visit_nodes, &ctx ); rtems_test_assert( ctx.current == ctx.count ); } @@ -2071,7 +2070,7 @@ rtems_task Init( rtems_task_argument ignored ) node_array[i].key = numbers[i]; rb_insert_unique( &rbtree1, &node_array[i].Node ); - _RBTree_Iterate( &rbtree1, RBT_RIGHT, visit_nodes, &ctx ); + _RBTree_Iterate( &rbtree1, visit_nodes, &ctx ); rtems_test_assert( ctx.current == ctx.count ); if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) @@ -2098,7 +2097,7 @@ rtems_task Init( rtems_task_argument ignored ) if ( id < 19 ) { visitor_context ctx = { 0, 20 - id - 1, test_remove_trees[ id ] }; - _RBTree_Iterate( &rbtree1, RBT_RIGHT, visit_nodes, &ctx ); + _RBTree_Iterate( &rbtree1, visit_nodes, &ctx ); rtems_test_assert( ctx.current == ctx.count ); } } |