Changeset 64939bc in rtems for cpukit/sapi


Ignore:
Timestamp:
Jul 12, 2014, 7:22:22 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
ed7a028
Parents:
7e119990
git-author:
Sebastian Huber <sebastian.huber@…> (07/12/14 19:22:22)
git-committer:
Joel Sherrill <joel.sherrill@…> (07/15/14 15:03:48)
Message:

rbtree: Reduce RBTree_Control size

Remove compare function and is unique indicator from the control
structure. Rename RBTree_Compare_function to RBTree_Compare. Rename
rtems_rbtree_compare_function to rtems_rbtree_compare. Provide C++
compatible initializers. Add compare function and is unique indicator
to _RBTree_Find(), _RBTree_Insert(), rtems_rbtree_find() and
rtems_rbtree_insert(). Remove _RBTree_Is_unique() and
rtems_rbtree_is_unique(). Remove compare function and is unique
indicator from _RBTree_Initialize_empty() and
rtems_rbtree_initialize_empty().

Location:
cpukit/sapi
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/include/rtems/rbtree.h

    r7e119990 r64939bc  
    5656
    5757/**
    58  * @typedef rtems_rbtree_compare_function
    59  *
    6058 * This type defines function pointers for user-provided comparison
    6159 * function. The function compares two nodes in order to determine
    6260 * the order in a red-black tree.
    6361 */
    64 typedef RBTree_Compare_function rtems_rbtree_compare_function;
     62typedef RBTree_Compare rtems_rbtree_compare;
    6563
    6664/**
     
    9492 */
    9593RTEMS_INLINE_ROUTINE void rtems_rbtree_initialize(
    96   rtems_rbtree_control          *the_rbtree,
    97   rtems_rbtree_compare_function  compare_function,
    98   void                          *starting_address,
    99   size_t                         number_nodes,
    100   size_t                         node_size,
    101   bool                           is_unique
    102 )
    103 {
    104   _RBTree_Initialize( the_rbtree, compare_function, starting_address,
     94  rtems_rbtree_control *the_rbtree,
     95  rtems_rbtree_compare  compare,
     96  void                 *starting_address,
     97  size_t                number_nodes,
     98  size_t                node_size,
     99  bool                  is_unique
     100)
     101{
     102  _RBTree_Initialize( the_rbtree, compare, starting_address,
    105103    number_nodes, node_size, is_unique);
    106104}
     
    112110 */
    113111RTEMS_INLINE_ROUTINE void rtems_rbtree_initialize_empty(
    114   rtems_rbtree_control          *the_rbtree,
    115   rtems_rbtree_compare_function  compare_function,
    116   bool                           is_unique
    117 )
    118 {
    119   _RBTree_Initialize_empty( the_rbtree, compare_function, is_unique );
     112  rtems_rbtree_control *the_rbtree
     113)
     114{
     115  _RBTree_Initialize_empty( the_rbtree );
    120116}
    121117
     
    278274RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_find(
    279275  const rtems_rbtree_control *the_rbtree,
    280   const rtems_rbtree_node *the_node
    281 )
    282 {
    283   return _RBTree_Find( the_rbtree, the_node );
     276  const rtems_rbtree_node    *the_node,
     277  rtems_rbtree_compare        compare,
     278  bool                        is_unique
     279)
     280{
     281  return _RBTree_Find( the_rbtree, the_node, compare, is_unique );
    284282}
    285283
     
    386384RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_insert(
    387385  rtems_rbtree_control *the_rbtree,
    388   rtems_rbtree_node *the_node
    389 )
    390 {
    391   return _RBTree_Insert( the_rbtree, the_node );
    392 }
    393 
    394 /**
    395  * @brief Determines whether the tree is unique.
    396  */
    397 RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_unique(
    398   const rtems_rbtree_control *the_rbtree
    399 )
    400 {
    401   return _RBTree_Is_unique(the_rbtree);
     386  rtems_rbtree_node    *the_node,
     387  rtems_rbtree_compare  compare,
     388  bool                  is_unique
     389)
     390{
     391  return _RBTree_Insert( the_rbtree, the_node, compare, is_unique );
    402392}
    403393
  • cpukit/sapi/src/rbheap.c

    r7e119990 r64939bc  
    8181)
    8282{
    83   _RBTree_Insert(tree, &chunk->tree_node);
     83  rtems_rbtree_insert(tree, &chunk->tree_node, chunk_compare, true);
    8484}
    8585
     
    108108      rtems_chain_initialize_empty(free_chain);
    109109      rtems_chain_initialize_empty(&control->spare_descriptor_chain);
    110       rtems_rbtree_initialize_empty(chunk_tree, chunk_compare, true);
     110      rtems_rbtree_initialize_empty(chunk_tree);
    111111      control->alignment = alignment;
    112112      control->handler_arg = handler_arg;
     
    199199
    200200  return rtems_rbheap_chunk_of_node(
    201     _RBTree_Find(chunk_tree, &chunk.tree_node)
     201    rtems_rbtree_find(chunk_tree, &chunk.tree_node, chunk_compare, true)
    202202  );
    203203}
     
    231231    rtems_chain_extract_unprotected(&b->chain_node);
    232232    add_to_chain(free_chain, b);
    233     _RBTree_Extract(chunk_tree, &b->tree_node);
     233    rtems_rbtree_extract(chunk_tree, &b->tree_node);
    234234  }
    235235}
Note: See TracChangeset for help on using the changeset viewer.