4.115
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Initialize a RBTree Header |
---|
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 | void _RBTree_Initialize( |
---|
26 | RBTree_Control *the_rbtree, |
---|
27 | RBTree_Compare_function compare_function, |
---|
28 | void *starting_address, |
---|
29 | size_t number_nodes, |
---|
30 | size_t node_size, |
---|
31 | bool is_unique |
---|
32 | ) |
---|
33 | { |
---|
34 | size_t count; |
---|
35 | RBTree_Node *next; |
---|
36 | |
---|
37 | /* TODO: Error message? */ |
---|
38 | if (!the_rbtree) return; |
---|
39 | |
---|
40 | /* could do sanity checks here */ |
---|
41 | _RBTree_Initialize_empty(the_rbtree, compare_function, is_unique); |
---|
42 | |
---|
43 | count = number_nodes; |
---|
44 | next = starting_address; |
---|
45 | while ( count-- ) { |
---|
46 | _RBTree_Insert_unprotected(the_rbtree, next); |
---|
47 | next = (RBTree_Node *) |
---|
48 | _Addresses_Add_offset( (void *) next, node_size ); |
---|
49 | } |
---|
50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.