Changeset dc62a48c in rtems


Ignore:
Timestamp:
Apr 10, 2012, 8:25:14 AM (10 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
112396de
Parents:
7afcb26
git-author:
Sebastian Huber <sebastian.huber@…> (04/10/12 08:25:14)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/11/12 09:24:18)
Message:

rbtree: PR1995: API change

New functions

o _RBTree_Next_unprotected(),
o _RBTree_Next(),
o _RBTree_Successor_unprotected(),
o _RBTree_Predecessor_unprotected(),
o rtems_rbtree_successor_unprotected(), and
o rtems_rbtree_predecessor_unprotected().

Change prototype of

o _RBTree_Successor(),
o _RBTree_Predecessor(),
o rtems_rbtree_successor(), and
o rtems_rbtree_predecessor().

Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/inline/rtems/rbtree.inl

    r7afcb26 rdc62a48c  
    272272}
    273273
    274 /** @brief Find the node's in-order predecessor
    275  *
    276  * This function returns a pointer to the in-order predecessor
    277  * of @a the_node if it exists, and NULL if not.
     274/**
     275 * @copydoc _RBTree_Predecessor_unprotected()
     276 */
     277RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_predecessor_unprotected(
     278  const rtems_rbtree_control *rbtree,
     279  const rtems_rbtree_node *node
     280)
     281{
     282  return _RBTree_Predecessor_unprotected( rbtree, node );
     283}
     284
     285/**
     286 * @copydoc _RBTree_Predecessor()
    278287 */
    279288RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_predecessor(
    280   rtems_rbtree_node *the_node
    281 )
    282 {
    283   return _RBTree_Predecessor( the_node );
    284 }
    285 
    286 /** @brief Find the node's in-order successor
    287  *
    288  *  This function returns a pointer to the in-order successor 
    289  *  of @a the_node if it exists, and NULL if not.
     289  const rtems_rbtree_control *rbtree,
     290  const rtems_rbtree_node *node
     291)
     292{
     293  return _RBTree_Predecessor( rbtree, node );
     294}
     295
     296/**
     297 * @copydoc _RBTree_Successor_unprotected()
     298 */
     299RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_successor_unprotected(
     300  const rtems_rbtree_control *rbtree,
     301  const rtems_rbtree_node *node
     302)
     303{
     304  return _RBTree_Successor_unprotected( rbtree, node );
     305}
     306
     307/**
     308 * @copydoc _RBTree_Successor()
    290309 */
    291310RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_successor(
    292   rtems_rbtree_node *the_node
    293 )
    294 {
    295   return _RBTree_Successor( the_node );
     311  const rtems_rbtree_control *rbtree,
     312  const rtems_rbtree_node *node
     313)
     314{
     315  return _RBTree_Successor( rbtree, node );
    296316}
    297317
  • cpukit/score/Makefile.am

    r7afcb26 rdc62a48c  
    266266libscore_a_SOURCES += src/rbtree.c \
    267267    src/rbtreeextract.c src/rbtreefind.c src/rbtreefindheader.c \
    268     src/rbtreeget.c src/rbtreeinsert.c src/rbtreepeek.c
     268    src/rbtreeget.c src/rbtreeinsert.c src/rbtreepeek.c src/rbtreenext.c
    269269
    270270## THREAD_C_FILES
  • cpukit/score/include/rtems/score/rbtree.h

    r7afcb26 rdc62a48c  
    322322);
    323323
     324/**
     325 * @brief Returns the in-order next node of a node.
     326 *
     327 * @param[in] rbtree The red-black tree.
     328 * @param[in] node The node.
     329 * @param[in] dir The direction.
     330 *
     331 * @retval NULL The in-order next node does not exist.
     332 * @retval otherwise The next node.
     333 */
     334RBTree_Node *_RBTree_Next_unprotected(
     335  const RBTree_Control *rbtree,
     336  const RBTree_Node *node,
     337  RBTree_Direction dir
     338);
     339
     340/**
     341 * @copydoc _RBTree_Next_unprotected()
     342 *
     343 * The function disables the interrupts protect the operation.
     344 */
     345RBTree_Node *_RBTree_Next(
     346  const RBTree_Control *rbtree,
     347  const RBTree_Node *node,
     348  RBTree_Direction dir
     349);
     350
    324351#ifndef __RTEMS_APPLICATION__
    325352#include <rtems/score/rbtree.inl>
  • cpukit/score/inline/rtems/score/rbtree.inl

    r7afcb26 rdc62a48c  
    377377}
    378378
    379 /** @brief Find the nodes in-order predecessor
    380  *
    381  *  This function returns a pointer to the in-order predecessor
    382  *  of @a the_node if it exists, and NULL if not.
     379/**
     380 * @brief Returns the predecessor of a node.
     381 *
     382 * @param[in] rbtree The red-black tree.
     383 * @param[in] node The node.
     384 *
     385 * @retval NULL The predecessor does not exist.
     386 * @retval otherwise The predecessor node.
     387 */
     388RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Predecessor_unprotected(
     389  const RBTree_Control *rbtree,
     390  const RBTree_Node *node
     391)
     392{
     393  return _RBTree_Next_unprotected( rbtree, node, RBT_LEFT );
     394}
     395
     396/**
     397 * @copydoc _RBTree_Predecessor_unprotected()
     398 *
     399 * The function disables the interrupts protect the operation.
    383400 */
    384401RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Predecessor(
    385     RBTree_Node *the_node
    386     )
    387 {
    388   RBTree_Node* iter_node;
    389   if (!the_node) return NULL;
    390   iter_node = the_node->child[RBT_LEFT];
    391   if (!iter_node) return NULL;
    392   while (iter_node->child[RBT_RIGHT]) {
    393     iter_node = iter_node->child[RBT_RIGHT];
    394   }
    395   return iter_node;
    396 }
    397 
    398 /** @brief Find the nodes in-order successor
    399  *
    400  *  This function returns a pointer to the in-order successor 
    401  *  of @a the_node if it exists, and NULL if not.
     402  const RBTree_Control *rbtree,
     403  const RBTree_Node *node
     404)
     405{
     406  return _RBTree_Next( rbtree, node, RBT_LEFT );
     407}
     408
     409/**
     410 * @brief Returns the successor of a node.
     411 *
     412 * @param[in] rbtree The red-black tree.
     413 * @param[in] node The node.
     414 *
     415 * @retval NULL The successor does not exist.
     416 * @retval otherwise The successor node.
     417 */
     418RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Successor_unprotected(
     419  const RBTree_Control *rbtree,
     420  const RBTree_Node *node
     421)
     422{
     423  return _RBTree_Next_unprotected( rbtree, node, RBT_RIGHT );
     424}
     425
     426/**
     427 * @copydoc _RBTree_Successor_unprotected()
     428 *
     429 * The function disables the interrupts protect the operation.
    402430 */
    403431RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Successor(
    404     RBTree_Node *the_node
    405     )
    406 {
    407   RBTree_Node* iter_node;
    408   if (!the_node) return NULL;
    409   iter_node = the_node->child[RBT_RIGHT];
    410   if (!iter_node) return NULL;
    411   while (iter_node->child[RBT_LEFT]) {
    412     iter_node = iter_node->child[RBT_LEFT];
    413   }
    414   return iter_node;
     432  const RBTree_Control *rbtree,
     433  const RBTree_Node *node
     434)
     435{
     436  return _RBTree_Next( rbtree, node, RBT_RIGHT );
    415437}
    416438
  • testsuites/sptests/sprbtree01/init.c

    r7afcb26 rdc62a48c  
    441441
    442442  puts( "INIT - Verify rtems_rbtree_predecessor/successor");
    443   p = rtems_rbtree_predecessor(p);
     443  p = rtems_rbtree_predecessor(&rbtree1, p);
    444444  if(p && rtems_rbtree_container_of(p,test_node,Node)->id != 29) {
    445445    puts ("INIT - ERROR ON RBTREE ID MISMATCH");
     
    447447  }
    448448  p = rtems_rbtree_find(&rbtree1, &search_node.Node);
    449   p = rtems_rbtree_successor(p);
     449  p = rtems_rbtree_successor(&rbtree1, p);
    450450  if(p && rtems_rbtree_container_of(p,test_node,Node)->id != 31) {
    451451    puts ("INIT - ERROR ON RBTREE ID MISMATCH");
Note: See TracChangeset for help on using the changeset viewer.