[rtems commit] rbtree: PR2046: Replace rtems_rbtree_unique

Sebastian Huber sebh at rtems.org
Fri Apr 13 07:13:30 UTC 2012


Module:    rtems
Branch:    master
Commit:    8c6608bd1b1eed2a956f4268ea03fa0e05ec9a94
Changeset: http://git.rtems.org/rtems/commit/?id=8c6608bd1b1eed2a956f4268ea03fa0e05ec9a94

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Apr 13 09:10:12 2012 +0200

rbtree: PR2046: Replace rtems_rbtree_unique

---

 cpukit/sapi/include/rtems/rbtree.h   |   14 --------------
 cpukit/sapi/inline/rtems/rbtree.inl  |    6 +++---
 testsuites/sptests/sprbtree01/init.c |    8 +++-----
 3 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/cpukit/sapi/include/rtems/rbtree.h b/cpukit/sapi/include/rtems/rbtree.h
index 9a09b27..c39512d 100644
--- a/cpukit/sapi/include/rtems/rbtree.h
+++ b/cpukit/sapi/include/rtems/rbtree.h
@@ -52,20 +52,6 @@ typedef RBTree_Control rtems_rbtree_control;
 typedef RBTree_Compare_function rtems_rbtree_compare_function;
 
 /**
- * @typedef rtems_rbtree_unique
- *
- * This enum type defines whether the tree can contain nodes with
- * duplicate keys.
- */
-typedef enum {
-  /** The tree is not unique, insertion of duplicate keys is performed
-   *  in a FIFO manner. */
-  RTEMS_RBTREE_DUPLICATE = false,
-  /** The tree is unique, insertion of duplicate key is refused. */
-  RTEMS_RBTREE_UNIQUE    = true
-} rtems_rbtree_unique;
-
-/**
  *  @brief RBTree initializer for an empty rbtree with designator @a name.
  */
 #define RTEMS_RBTREE_INITIALIZER_EMPTY(name) \
diff --git a/cpukit/sapi/inline/rtems/rbtree.inl b/cpukit/sapi/inline/rtems/rbtree.inl
index 1a2e99e..ab81baf 100644
--- a/cpukit/sapi/inline/rtems/rbtree.inl
+++ b/cpukit/sapi/inline/rtems/rbtree.inl
@@ -40,7 +40,7 @@ RTEMS_INLINE_ROUTINE void rtems_rbtree_initialize(
   void                          *starting_address,
   size_t                         number_nodes,
   size_t                         node_size,
-  rtems_rbtree_unique            is_unique
+  bool                           is_unique
 )
 {
   _RBTree_Initialize( the_rbtree, compare_function, starting_address,
@@ -55,7 +55,7 @@ RTEMS_INLINE_ROUTINE void rtems_rbtree_initialize(
 RTEMS_INLINE_ROUTINE void rtems_rbtree_initialize_empty(
   rtems_rbtree_control          *the_rbtree,
   rtems_rbtree_compare_function  compare_function,
-  rtems_rbtree_unique            is_unique
+  bool                           is_unique
 )
 {
   _RBTree_Initialize_empty( the_rbtree, compare_function, is_unique );
@@ -423,7 +423,7 @@ RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_insert(
 
 /** @brief Determines whether the tree is unique
  */
-RTEMS_INLINE_ROUTINE rtems_rbtree_unique rtems_rbtree_is_unique(
+RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_unique(
   const rtems_rbtree_control *the_rbtree
 )
 {
diff --git a/testsuites/sptests/sprbtree01/init.c b/testsuites/sptests/sprbtree01/init.c
index f3f9c29..7d0d3f6 100644
--- a/testsuites/sptests/sprbtree01/init.c
+++ b/testsuites/sptests/sprbtree01/init.c
@@ -102,8 +102,7 @@ rtems_task Init(
   puts( "\n\n*** TEST OF RTEMS RBTREE API ***" );
 
   puts( "Init - Initialize rbtree empty" );
-  rtems_rbtree_initialize_empty( &rbtree1, &test_compare_function,
-                                 RTEMS_RBTREE_UNIQUE );
+  rtems_rbtree_initialize_empty( &rbtree1, &test_compare_function, true );
 
   if ( !rtems_rbtree_is_unique( &rbtree1 ) )
     puts( "INIT - FAILED IS UNIQUE CHECK" );
@@ -542,7 +541,7 @@ rtems_task Init(
   }
   rtems_rbtree_initialize( &rbtree1, &test_compare_function,
                            &node_array[0].Node, 100,
-                           sizeof(test_node), RTEMS_RBTREE_UNIQUE );
+                           sizeof(test_node), true );
 
   puts( "INIT - Removing 100 nodes" );
 
@@ -570,8 +569,7 @@ rtems_task Init(
 
   /* Initialize the tree for duplicate keys */
   puts( "Init - Initialize duplicate rbtree empty" );
-  rtems_rbtree_initialize_empty( &rbtree1, &test_compare_function,
-                                 RTEMS_RBTREE_DUPLICATE );
+  rtems_rbtree_initialize_empty( &rbtree1, &test_compare_function, false );
 
   if ( rtems_rbtree_is_unique( &rbtree1 ) )
     puts( "INIT - FAILED IS UNIQUE CHECK" );




More information about the vc mailing list