5
Last change
on this file since 599d71f was
ddb6a49b,
checked in by Sebastian Huber <sebastian.huber@…>, on 08/21/15 at 03:57:42
|
rbtree: Delete _RBTree_Initialize()
This function has no internal use case.
|
-
Property mode set to
100644
|
File size:
1014 bytes
|
Rev | Line | |
---|
[ddb6a49b] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @brief Initialize a Red-Black Tree |
---|
| 5 | * @ingroup ClassicRBTrees |
---|
| 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.org/license/LICENSE. |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #if HAVE_CONFIG_H |
---|
| 17 | #include "config.h" |
---|
| 18 | #endif |
---|
| 19 | |
---|
| 20 | #include <rtems/rbtree.h> |
---|
| 21 | #include <rtems/score/address.h> |
---|
| 22 | |
---|
| 23 | void rtems_rbtree_initialize( |
---|
| 24 | rtems_rbtree_control *the_rbtree, |
---|
| 25 | rtems_rbtree_compare compare, |
---|
| 26 | void *starting_address, |
---|
| 27 | size_t number_nodes, |
---|
| 28 | size_t node_size, |
---|
| 29 | bool is_unique |
---|
| 30 | ) |
---|
| 31 | { |
---|
| 32 | size_t count; |
---|
| 33 | rtems_rbtree_node *next; |
---|
| 34 | |
---|
| 35 | /* could do sanity checks here */ |
---|
| 36 | rtems_rbtree_initialize_empty( the_rbtree ); |
---|
| 37 | |
---|
| 38 | count = number_nodes; |
---|
| 39 | next = starting_address; |
---|
| 40 | |
---|
| 41 | while ( count-- ) { |
---|
| 42 | rtems_rbtree_insert( the_rbtree, next, compare, is_unique ); |
---|
| 43 | next = (rtems_rbtree_node *) _Addresses_Add_offset( next, node_size ); |
---|
| 44 | } |
---|
| 45 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.