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 | |
parent | rbtree: Delete _RBTree_Get() (diff) | |
download | rtems-ddb6a49bdf27206c55f4a2e92e2c62553ff4d7af.tar.bz2 |
rbtree: Delete _RBTree_Initialize()
This function has no internal use case.
-rw-r--r-- | cpukit/sapi/Makefile.am | 1 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/rbtree.h | 18 | ||||
-rw-r--r-- | cpukit/sapi/src/rbtree.c | 45 | ||||
-rw-r--r-- | cpukit/score/Makefile.am | 2 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/rbtree.h | 24 | ||||
-rw-r--r-- | cpukit/score/src/rbtree.c | 47 |
6 files changed, 58 insertions, 79 deletions
diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am index d7fd9aac63..76ff2fe933 100644 --- a/cpukit/sapi/Makefile.am +++ b/cpukit/sapi/Makefile.am @@ -39,6 +39,7 @@ libsapi_a_SOURCES += src/chainsmp.c libsapi_a_SOURCES += src/cpucounterconverter.c libsapi_a_SOURCES += src/delayticks.c libsapi_a_SOURCES += src/delaynano.c +libsapi_a_SOURCES += src/rbtree.c libsapi_a_SOURCES += src/profilingiterate.c libsapi_a_SOURCES += src/profilingreportxml.c libsapi_a_SOURCES += src/tcsimpleinstall.c diff --git a/cpukit/sapi/include/rtems/rbtree.h b/cpukit/sapi/include/rtems/rbtree.h index 4d8007356e..26041890b2 100644 --- a/cpukit/sapi/include/rtems/rbtree.h +++ b/cpukit/sapi/include/rtems/rbtree.h @@ -82,19 +82,23 @@ typedef RBTree_Compare rtems_rbtree_compare; * This routine initializes @a the_rbtree structure to manage the * contiguous array of @a number_nodes nodes which starts at * @a starting_address. Each node is of @a node_size bytes. - */ -RTEMS_INLINE_ROUTINE void rtems_rbtree_initialize( + * + * @param[in] the_rbtree is the pointer to rbtree header + * @param[in] compare The node compare function. + * @param[in] starting_address is the starting address of first node + * @param[in] number_nodes is the number of nodes in rbtree + * @param[in] node_size is the size of node in bytes + * @param[in] is_unique If true, then reject nodes with a duplicate key, else + * otherwise. + */ +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 -) -{ - _RBTree_Initialize( the_rbtree, compare, starting_address, - number_nodes, node_size, is_unique); -} +); /** * @brief Initialize this RBTree as Empty 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 ); + } +} diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index 03ceb7aff9..507d49f739 100644 --- a/cpukit/score/Makefile.am +++ b/cpukit/score/Makefile.am @@ -283,7 +283,7 @@ libscore_a_SOURCES += src/pheapallocate.c \ libscore_a_SOURCES += src/freechain.c ## RBTREE_C_FILES -libscore_a_SOURCES += src/rbtree.c \ +libscore_a_SOURCES += \ src/rbtreeextract.c src/rbtreefind.c \ src/rbtreeinsert.c src/rbtreeiterate.c src/rbtreenext.c diff --git a/cpukit/score/include/rtems/score/rbtree.h b/cpukit/score/include/rtems/score/rbtree.h index ea8f4af5ee..c01de799ea 100644 --- a/cpukit/score/include/rtems/score/rbtree.h +++ b/cpukit/score/include/rtems/score/rbtree.h @@ -169,30 +169,6 @@ typedef struct { RBTree_Node name = RBTREE_NODE_INITIALIZER_EMPTY( name ) /** - * @brief Initialize a RBTree Header. - * - * This routine initializes @a the_rbtree structure to manage the - * contiguous array of @a number_nodes nodes which starts at - * @a starting_address. Each node is of @a node_size bytes. - * - * @param[in] the_rbtree is the pointer to rbtree header - * @param[in] compare The node compare function. - * @param[in] starting_address is the starting address of first node - * @param[in] number_nodes is the number of nodes in rbtree - * @param[in] node_size is the size of node in bytes - * @param[in] is_unique If true, then reject nodes with a duplicate key, else - * otherwise. - */ -void _RBTree_Initialize( - RBTree_Control *the_rbtree, - RBTree_Compare compare, - void *starting_address, - size_t number_nodes, - size_t node_size, - bool is_unique -); - -/** * @brief Tries to find a node for the specified key in the tree. * * @param[in] the_rbtree The red-black tree control. diff --git a/cpukit/score/src/rbtree.c b/cpukit/score/src/rbtree.c deleted file mode 100644 index 064cc0c19f..0000000000 --- a/cpukit/score/src/rbtree.c +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @file - * - * @brief Initialize a RBTree Header - * @ingroup ScoreRBTree - */ - -/* - * 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/system.h> -#include <rtems/score/address.h> -#include <rtems/score/rbtree.h> -#include <rtems/score/isr.h> - -void _RBTree_Initialize( - RBTree_Control *the_rbtree, - RBTree_Compare compare, - void *starting_address, - size_t number_nodes, - size_t node_size, - bool is_unique -) -{ - size_t count; - RBTree_Node *next; - - /* could do sanity checks here */ - _RBTree_Initialize_empty( the_rbtree ); - - count = number_nodes; - next = starting_address; - - while ( count-- ) { - _RBTree_Insert( the_rbtree, next, compare, is_unique ); - next = (RBTree_Node *) _Addresses_Add_offset( next, node_size ); - } -} |