Changeset 64939bc in rtems for cpukit/score/src/rbtreefind.c


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().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/rbtreefind.c

    r7e119990 r64939bc  
    1919
    2020#include <rtems/score/rbtreeimpl.h>
    21 #include <rtems/score/isr.h>
    2221
    2322RBTree_Node *_RBTree_Find(
    2423  const RBTree_Control *the_rbtree,
    25   const RBTree_Node *the_node
     24  const RBTree_Node    *the_node,
     25  RBTree_Compare        compare,
     26  bool                  is_unique
    2627)
    2728{
    2829  RBTree_Node* iter_node = the_rbtree->root;
    2930  RBTree_Node* found = NULL;
    30   int compare_result;
    31   while (iter_node) {
    32     compare_result = the_rbtree->compare_function(the_node, iter_node);
     31
     32  while ( iter_node != NULL ) {
     33    int compare_result = ( *compare )( the_node, iter_node );
     34    RBTree_Direction dir;
     35
    3336    if ( _RBTree_Is_equal( compare_result ) ) {
    3437      found = iter_node;
    35       if ( the_rbtree->is_unique )
     38      if ( is_unique )
    3639        break;
    3740    }
    3841
    39     RBTree_Direction dir =
    40       (RBTree_Direction) _RBTree_Is_greater( compare_result );
    41     iter_node = iter_node->child[dir];
    42   } /* while(iter_node) */
     42    dir = (RBTree_Direction) _RBTree_Is_greater( compare_result );
     43    iter_node = iter_node->child[ dir ];
     44  }
    4345
    4446  return found;
Note: See TracChangeset for help on using the changeset viewer.