summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-17 07:50:01 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-22 14:37:11 +0200
commit69a6802bfa8878d3e9a8296c1516ff5feac77bbc (patch)
tree13b6fa37a0858315315665621e2714b4a5d1caf2 /cpukit/score
parentscore: Move _RBTree_Insert() (diff)
downloadrtems-69a6802bfa8878d3e9a8296c1516ff5feac77bbc.tar.bz2
score: Move _RBTree_Find()
The _RBTree_Find() is no longer used in the score. Move it to sapi and make it rtems_rbtree_find(). Move corresponding types and support functions to sapi.
Diffstat (limited to '')
-rw-r--r--cpukit/score/Makefile.am2
-rw-r--r--cpukit/score/include/rtems/score/rbtree.h48
-rw-r--r--cpukit/score/include/rtems/score/rbtreeimpl.h21
-rw-r--r--cpukit/score/src/rbtreefind.c50
4 files changed, 1 insertions, 120 deletions
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 97f0b3d615..a58aedcc09 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -292,7 +292,7 @@ libscore_a_SOURCES += src/freechain.c
## RBTREE_C_FILES
libscore_a_SOURCES += \
- src/rbtreeextract.c src/rbtreefind.c \
+ src/rbtreeextract.c \
src/rbtreeinsert.c src/rbtreeiterate.c src/rbtreenext.c
libscore_a_SOURCES += src/rbtreereplace.c
diff --git a/cpukit/score/include/rtems/score/rbtree.h b/cpukit/score/include/rtems/score/rbtree.h
index f0590c0904..e7e65f7b91 100644
--- a/cpukit/score/include/rtems/score/rbtree.h
+++ b/cpukit/score/include/rtems/score/rbtree.h
@@ -57,33 +57,6 @@ typedef struct RBTree_Node {
typedef RB_HEAD(RBTree_Control, RBTree_Node) RBTree_Control;
/**
- * @brief Integer type for compare results.
- *
- * The type is large enough to represent pointers and 32-bit signed integers.
- *
- * @see RBTree_Compare.
- */
-typedef long RBTree_Compare_result;
-
-/**
- * @brief Compares two red-black tree nodes.
- *
- * @param[in] first The first node.
- * @param[in] second The second node.
- *
- * @retval positive The key value of the first node is greater than the one of
- * the second node.
- * @retval 0 The key value of the first node is equal to the one of the second
- * node.
- * @retval negative The key value of the first node is less than the one of the
- * second node.
- */
-typedef RBTree_Compare_result ( *RBTree_Compare )(
- const RBTree_Node *first,
- const RBTree_Node *second
-);
-
-/**
* @brief Initializer for an empty red-black tree with designator @a name.
*/
#define RBTREE_INITIALIZER_EMPTY( name ) \
@@ -96,27 +69,6 @@ typedef RBTree_Compare_result ( *RBTree_Compare )(
RBTree_Control name = RBTREE_INITIALIZER_EMPTY( name )
/**
- * @brief Tries to find a node for the specified key in the tree.
- *
- * @param[in] the_rbtree The red-black tree control.
- * @param[in] the_node A node specifying the key.
- * @param[in] compare The node compare function.
- * @param[in] is_unique If true, then return the first node with a key equal to
- * the one of the node specified if it exits, else return the last node if it
- * exists.
- *
- * @retval node A node corresponding to the key. If the tree is not unique
- * and contains duplicate keys, the set of duplicate keys acts as FIFO.
- * @retval NULL No node exists in the tree for the key.
- */
-RBTree_Node *_RBTree_Find(
- const RBTree_Control *the_rbtree,
- const RBTree_Node *the_node,
- RBTree_Compare compare,
- bool is_unique
-);
-
-/**
* @brief Rebalances the red-black tree after insertion of the node.
*
* @param[in] the_rbtree The red-black tree control.
diff --git a/cpukit/score/include/rtems/score/rbtreeimpl.h b/cpukit/score/include/rtems/score/rbtreeimpl.h
index 9c748eb01c..bf92e29228 100644
--- a/cpukit/score/include/rtems/score/rbtreeimpl.h
+++ b/cpukit/score/include/rtems/score/rbtreeimpl.h
@@ -62,27 +62,6 @@ void _RBTree_Iterate(
void *visitor_arg
);
-RTEMS_INLINE_ROUTINE bool _RBTree_Is_equal(
- RBTree_Compare_result compare_result
-)
-{
- return compare_result == 0;
-}
-
-RTEMS_INLINE_ROUTINE bool _RBTree_Is_greater(
- RBTree_Compare_result compare_result
-)
-{
- return compare_result > 0;
-}
-
-RTEMS_INLINE_ROUTINE bool _RBTree_Is_lesser(
- RBTree_Compare_result compare_result
-)
-{
- return compare_result < 0;
-}
-
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/score/src/rbtreefind.c b/cpukit/score/src/rbtreefind.c
deleted file mode 100644
index f920febd41..0000000000
--- a/cpukit/score/src/rbtreefind.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @file
- *
- * @brief Find the control structure of the tree containing the given node
- * @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/score/rbtreeimpl.h>
-
-RBTree_Node *_RBTree_Find(
- const RBTree_Control *the_rbtree,
- const RBTree_Node *the_node,
- RBTree_Compare compare,
- bool is_unique
-)
-{
- RBTree_Node *iter_node = _RBTree_Root( the_rbtree );
- RBTree_Node *found = NULL;
-
- while ( iter_node != NULL ) {
- RBTree_Compare_result compare_result = ( *compare )( the_node, iter_node );
-
- if ( _RBTree_Is_equal( compare_result ) ) {
- found = iter_node;
-
- if ( is_unique )
- break;
- }
-
- if ( _RBTree_Is_greater( compare_result ) ) {
- iter_node = _RBTree_Right( iter_node );
- } else {
- iter_node = _RBTree_Left( iter_node );
- }
- }
-
- return found;
-}