Changeset 22d9575 in rtems


Ignore:
Timestamp:
Jul 4, 2018, 2:12:14 PM (10 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
1465e70c
Parents:
0cb4257
git-author:
Sebastian Huber <sebastian.huber@…> (07/04/18 14:12:14)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/16/18 05:22:11)
Message:

linux: Add rbtree_postorder_for_each_entry_safe()

Update #3465.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/linux/rbtree.h

    r0cb4257 r22d9575  
    123123}
    124124
     125#define rbtree_postorder_for_each_entry_safe( node, next, root, field ) \
     126  for ( \
     127    node = _RBTree_Postorder_first( \
     128      (RBTree_Control *) root, \
     129      (size_t) ( (char *) &node->field - (char *) node ) \
     130    ); \
     131    node != NULL && ( \
     132      next = _RBTree_Postorder_next( \
     133        &node->field, \
     134        (size_t) ( (char *) &node->field - (char *) node ) \
     135      ), \
     136      node != NULL \
     137    ); \
     138    node = next \
     139  )
     140
    125141#endif /* _LINUX_RBTREE_H */
  • testsuites/sptests/sprbtree01/init.c

    r0cb4257 r22d9575  
    1414#include <rtems/rbtree.h>
    1515#include <rtems/score/rbtreeimpl.h>
     16
     17#include <linux/rbtree.h>
    1618
    1719const char rtems_test_name[] = "SPRBTREE 1";
     
    19101912{
    19111913  test_node *node;
     1914  test_node *next;
    19121915  size_t i;
    19131916
     
    19201923
    19211924  rtems_test_assert( node == NULL );
     1925
     1926  i = 0;
     1927  next = NULL;
     1928
     1929  rbtree_postorder_for_each_entry_safe( node, next, tree, Node ) {
     1930    rtems_test_assert( node == &node_array[ i ] );
     1931
     1932    if ( i < pt->node_count - 1 ) {
     1933      rtems_test_assert( next == &node_array[ i + 1 ] );
     1934    } else {
     1935      rtems_test_assert( next == NULL );
     1936    }
     1937
     1938    ++i;
     1939  }
     1940
     1941  rtems_test_assert( i == pt->node_count );
     1942  rtems_test_assert( node == NULL );
     1943  rtems_test_assert( next == NULL );
    19221944}
    19231945
Note: See TracChangeset for help on using the changeset viewer.