[rtems commit] rbtree: Delete _RBTree_Initialize()

Sebastian Huber sebh at rtems.org
Mon Aug 31 08:41:20 UTC 2015


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Aug 21 05:57:42 2015 +0200

rbtree: Delete _RBTree_Initialize()

This function has no internal use case.

---

 cpukit/sapi/Makefile.am                   |  1 +
 cpukit/sapi/include/rtems/rbtree.h        | 18 +++++++-----
 cpukit/sapi/src/rbtree.c                  | 45 +++++++++++++++++++++++++++++
 cpukit/score/Makefile.am                  |  2 +-
 cpukit/score/include/rtems/score/rbtree.h | 24 ----------------
 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 d7fd9aa..76ff2fe 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 4d80073..2604189 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 0000000..57fbd63
--- /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 03ceb7a..507d49f 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 ea8f4af..c01de79 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 064cc0c..0000000
--- 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 );
-  }
-}




More information about the vc mailing list