Changeset e2fe881a in rtems


Ignore:
Timestamp:
Sep 27, 2017, 12:37:07 PM (20 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
dbdb6a32
Parents:
ef18d36
git-author:
Sebastian Huber <sebastian.huber@…> (09/27/17 12:37:07)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/27/17 12:56:47)
Message:

score: Simplify red-black tree debug support

Make the RBTree_Node layout independent of RTEMS_DEBUG (and all other
build configuration options). This allows the use of this structure in
Newlib.

Update #3112.

Location:
cpukit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/jffs2/include/linux/rbtree.h

    ref18d36 re2fe881a  
    2323  struct rb_node *rb_parent;
    2424  int rb_color;
    25 #if defined(RTEMS_DEBUG)
    26   const RBTree_Control *rb_tree;
    27 #endif
    2825};
    2926
  • cpukit/score/include/rtems/score/rbtree.h

    ref18d36 re2fe881a  
    5050typedef struct RBTree_Node {
    5151  RB_ENTRY(RBTree_Node) Node;
    52 #if defined(RTEMS_DEBUG)
    53   const struct RBTree_Control *tree;
    54 #endif
    5552} RBTree_Node;
    5653
     
    130127#if defined(RTEMS_DEBUG)
    131128  _RBTree_Set_off_tree( the_node );
    132   the_node->tree = NULL;
    133129#else
    134130  (void) the_node;
     
    409405{
    410406  _Assert( _RBTree_Is_node_off_tree( the_node ) );
    411 #if defined(RTEMS_DEBUG)
    412   _Assert( the_node->tree == NULL );
    413   the_node->tree = the_rbtree;
    414 #endif
    415407  RB_ROOT( the_rbtree ) = the_node;
    416408  RB_PARENT( the_node, Node ) = NULL;
  • cpukit/score/src/rbtreeextract.c

    ref18d36 re2fe881a  
    1717RB_GENERATE_REMOVE( RBTree_Control, RBTree_Node, Node, static )
    1818
     19#if defined(RTEMS_DEBUG)
     20static RBTree_Node *_RBTree_Find_root( const RBTree_Node *the_node )
     21{
     22  while ( true ) {
     23    const RBTree_Node *potential_root;
     24
     25    potential_root = the_node;
     26    the_node = _RBTree_Parent( the_node );
     27
     28    if ( the_node == NULL ) {
     29      return potential_root;
     30    }
     31  }
     32}
     33#endif
     34
    1935void _RBTree_Extract(
    2036  RBTree_Control *the_rbtree,
     
    2238)
    2339{
    24   _Assert( the_node->tree == the_rbtree );
     40  _Assert( _RBTree_Find_root( the_node ) == _RBTree_Root( the_rbtree ) );
    2541  RB_REMOVE( RBTree_Control, the_rbtree, the_node );
    2642  _RBTree_Initialize_node( the_node );
  • cpukit/score/src/rbtreeinsert.c

    ref18d36 re2fe881a  
    2020)
    2121{
    22 #if defined(RTEMS_DEBUG)
    23   _Assert( the_node->tree == NULL );
    24   the_node->tree = the_rbtree;
    25 #endif
    2622  RBTree_Control_RB_INSERT_COLOR( the_rbtree, the_node );
    2723}
Note: See TracChangeset for help on using the changeset viewer.