Changeset 768c483b in rtems


Ignore:
Timestamp:
Jun 17, 2016, 5:38:17 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
69a6802b
Parents:
99fc1d1d
git-author:
Sebastian Huber <sebastian.huber@…> (06/17/16 05:38:17)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/22/16 12:37:11)
Message:

score: Move _RBTree_Insert()

The _RBTree_Insert() is no longer used in the score. Move it to sapi
and make it rtems_rbtree_insert().

Location:
cpukit
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/Makefile.am

    r99fc1d1d r768c483b  
    4141libsapi_a_SOURCES += src/delaynano.c
    4242libsapi_a_SOURCES += src/rbtree.c
     43libsapi_a_SOURCES += src/rbtreeinsert.c
    4344libsapi_a_SOURCES += src/profilingiterate.c
    4445libsapi_a_SOURCES += src/profilingreportxml.c
  • cpukit/sapi/include/rtems/rbtree.h

    r99fc1d1d r768c483b  
    379379
    380380/**
    381  * @copydoc _RBTree_Insert()
    382  */
    383 RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_insert(
    384   rtems_rbtree_control *the_rbtree,
    385   rtems_rbtree_node    *the_node,
    386   rtems_rbtree_compare  compare,
    387   bool                  is_unique
    388 )
    389 {
    390   return _RBTree_Insert( the_rbtree, the_node, compare, is_unique );
    391 }
     381 * @brief Inserts the node into the red-black tree.
     382 *
     383 * In case the node is already a node of a tree, then this function yields
     384 * unpredictable results.
     385 *
     386 * @param[in] the_rbtree The red-black tree control.
     387 * @param[in] the_node The node to insert.
     388 * @param[in] compare The node compare function.
     389 * @param[in] is_unique If true, then reject nodes with a duplicate key, else
     390 *   insert nodes in FIFO order in case the key value is equal to existing nodes.
     391 *
     392 * @retval NULL Successfully inserted.
     393 * @retval existing_node This is a unique insert and there exists a node with
     394 *   an equal key in the tree already.
     395 */
     396rtems_rbtree_node *rtems_rbtree_insert(
     397  RBTree_Control *the_rbtree,
     398  RBTree_Node    *the_node,
     399  RBTree_Compare  compare,
     400  bool            is_unique
     401);
    392402
    393403/** @} */
  • cpukit/score/include/rtems/score/rbtree.h

    r99fc1d1d r768c483b  
    115115  RBTree_Compare        compare,
    116116  bool                  is_unique
    117 );
    118 
    119 /**
    120  * @brief Inserts the node into the red-black tree.
    121  *
    122  * In case the node is already a node of a tree, then this function yields
    123  * unpredictable results.
    124  *
    125  * @param[in] the_rbtree The red-black tree control.
    126  * @param[in] the_node The node to insert.
    127  * @param[in] compare The node compare function.
    128  * @param[in] is_unique If true, then reject nodes with a duplicate key, else
    129  *   insert nodes in FIFO order in case the key value is equal to existing nodes.
    130  *
    131  * @retval NULL Successfully inserted.
    132  * @retval existing_node This is a unique insert and there exists a node with
    133  *   an equal key in the tree already.
    134  */
    135 RBTree_Node *_RBTree_Insert(
    136   RBTree_Control *the_rbtree,
    137   RBTree_Node    *the_node,
    138   RBTree_Compare  compare,
    139   bool            is_unique
    140117);
    141118
  • cpukit/score/src/rbtreeinsert.c

    r99fc1d1d r768c483b  
    1313#include <rtems/score/rbtreeimpl.h>
    1414
    15 RTEMS_STATIC_ASSERT(
    16   sizeof( RBTree_Compare_result ) >= sizeof( intptr_t ),
    17   RBTree_Compare_result_intptr_t
    18 );
    19 
    20 RTEMS_STATIC_ASSERT(
    21   sizeof( RBTree_Compare_result ) >= sizeof( int32_t ),
    22   RBTree_Compare_result_int32_t
    23 );
    24 
    25 RBTree_Node *_RBTree_Insert(
    26   RBTree_Control *the_rbtree,
    27   RBTree_Node    *the_node,
    28   RBTree_Compare  compare,
    29   bool            is_unique
    30 )
    31 {
    32   RBTree_Node **which = _RBTree_Root_reference( the_rbtree );
    33   RBTree_Node  *parent = NULL;
    34 
    35   while ( *which != NULL ) {
    36     RBTree_Compare_result compare_result;
    37 
    38     parent = *which;
    39     compare_result = ( *compare )( the_node, parent );
    40 
    41     if ( is_unique && _RBTree_Is_equal( compare_result ) ) {
    42       return parent;
    43     }
    44 
    45     if ( _RBTree_Is_lesser( compare_result ) ) {
    46       which = _RBTree_Left_reference( parent );
    47     } else {
    48       which = _RBTree_Right_reference( parent );
    49     }
    50   }
    51 
    52   _RBTree_Add_child( the_node, parent, which );
    53   _RBTree_Insert_color( the_rbtree, the_node );
    54 
    55   return NULL;
    56 }
    57 
    5815RB_GENERATE_INSERT_COLOR( RBTree_Control, RBTree_Node, Node, static inline )
    5916
Note: See TracChangeset for help on using the changeset viewer.