Changeset b9877ee in rtems


Ignore:
Timestamp:
Aug 21, 2015, 3:55:04 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
ddb6a49b
Parents:
2d48456
git-author:
Sebastian Huber <sebastian.huber@…> (08/21/15 03:55:04)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/31/15 07:59:42)
Message:

rbtree: Delete _RBTree_Get()

This function has no internal use case.

Location:
cpukit
Files:
2 edited

Legend:

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

    r2d48456 rb9877ee  
    297297
    298298/**
    299  * @brief Obtain the min node on a rbtree.
    300  *
    301  * This function removes the min node from @a the_rbtree and returns
    302  * a pointer to that node.  If @a the_rbtree is empty, then NULL is returned.
    303  */
    304 
     299 * @brief Gets a node with the minimum key value from the red-black tree.
     300 *
     301 * This function extracts a node with the minimum key value from
     302 * tree and returns a pointer to that node if it exists.  In case multiple
     303 * nodes with a minimum key value exist, then they are extracted in FIFO order.
     304 *
     305 * @param[in] the_rbtree The red-black tree control.
     306 *
     307 * @retval NULL The tree is empty.
     308 * @retval node A node with the minimal key value on the tree.
     309 */
    305310RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_min(
    306311  rtems_rbtree_control *the_rbtree
    307312)
    308313{
    309   return _RBTree_Get( the_rbtree, RBT_LEFT );
    310 }
    311 
    312 /**
    313  * @brief Obtain the max node on a rbtree.
    314  *
    315  * This function removes the max node from @a the_rbtree and returns
    316  * a pointer to that node.  If @a the_rbtree is empty, then NULL is returned.
    317  */
    318 
     314  rtems_rbtree_node *the_node = rtems_rbtree_min( the_rbtree );
     315
     316  if ( the_node != NULL ) {
     317    rtems_rbtree_extract( the_rbtree, the_node );
     318  }
     319
     320  return the_node;
     321}
     322
     323/**
     324 * @brief Gets a node with the maximal key value from the red-black tree.
     325 *
     326 * This function extracts a node with the maximum key value from tree and
     327 * returns a pointer to that node if it exists.  In case multiple nodes with a
     328 * maximum key value exist, then they are extracted in LIFO order.
     329 *
     330 * @param[in] the_rbtree The red-black tree control.
     331 *
     332 * @retval NULL The tree is empty.
     333 * @retval node A node with the maximal key value on the tree.
     334 */
    319335RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_max(
    320336  rtems_rbtree_control *the_rbtree
    321337)
    322338{
    323   return _RBTree_Get( the_rbtree, RBT_RIGHT );
     339  rtems_rbtree_node *the_node = rtems_rbtree_max( the_rbtree );
     340
     341  if ( the_node != NULL ) {
     342    rtems_rbtree_extract( the_rbtree, the_node );
     343  }
     344
     345  return the_node;
    324346}
    325347
  • cpukit/score/include/rtems/score/rbtree.h

    r2d48456 rb9877ee  
    523523}
    524524
    525 /**
    526  * @brief Gets a node with an extremal key value from the red-black tree.
    527  *
    528  * This function extracts a node with the minimum or maximum key value from
    529  * tree and returns a pointer to that node if it exists.  In case multiple
    530  * nodes with a minimum key value exist, then they are extracted in FIFO order.
    531  * In case multiple nodes with a maximum key value exist, then they are
    532  * extracted in LIFO order.
    533  *
    534  * @param[in] the_rbtree The red-black tree control.
    535  * @param[in] dir Specifies whether to get a node with the minimum (RBT_LEFT)
    536  *   or maximum (RBT_RIGHT) key value.
    537  *
    538  * @retval NULL The tree is empty.
    539  * @retval extremal_node A node with a minimal or maximal key value on the
    540  *   tree.
    541  */
    542 RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Get(
    543   RBTree_Control *the_rbtree,
    544   RBTree_Direction dir
    545 )
    546 {
    547   RBTree_Node *the_node = the_rbtree->first[ dir ];
    548 
    549   if ( the_node != NULL ) {
    550     _RBTree_Extract( the_rbtree, the_node );
    551   }
    552 
    553   return the_node;
    554 }
    555 
    556525/**@}*/
    557526
Note: See TracChangeset for help on using the changeset viewer.