diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-08-21 05:57:42 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-08-31 09:59:42 +0200 |
commit | ddb6a49bdf27206c55f4a2e92e2c62553ff4d7af (patch) | |
tree | e0b911a0fcad7e5d39d0affbfc5ca3c23a6c5845 /cpukit/sapi/src/rbtree.c | |
parent | rbtree: Delete _RBTree_Get() (diff) | |
download | rtems-ddb6a49bdf27206c55f4a2e92e2c62553ff4d7af.tar.bz2 |
rbtree: Delete _RBTree_Initialize()
This function has no internal use case.
Diffstat (limited to 'cpukit/sapi/src/rbtree.c')
-rw-r--r-- | cpukit/sapi/src/rbtree.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/cpukit/sapi/src/rbtree.c b/cpukit/sapi/src/rbtree.c new file mode 100644 index 0000000000..57fbd63cfe --- /dev/null +++ b/cpukit/sapi/src/rbtree.c @@ -0,0 +1,45 @@ +/** + * @file + * + * @brief Initialize a Red-Black Tree + * @ingroup ClassicRBTrees + */ + +/* + * Copyright (c) 2010 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include <rtems/rbtree.h> +#include <rtems/score/address.h> + +void rtems_rbtree_initialize( + rtems_rbtree_control *the_rbtree, + rtems_rbtree_compare compare, + void *starting_address, + size_t number_nodes, + size_t node_size, + bool is_unique +) +{ + size_t count; + rtems_rbtree_node *next; + + /* could do sanity checks here */ + rtems_rbtree_initialize_empty( the_rbtree ); + + count = number_nodes; + next = starting_address; + + while ( count-- ) { + rtems_rbtree_insert( the_rbtree, next, compare, is_unique ); + next = (rtems_rbtree_node *) _Addresses_Add_offset( next, node_size ); + } +} |