Changeset 23de794d in rtems


Ignore:
Timestamp:
Aug 26, 2013, 12:27:52 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
58a5889
Parents:
d56f76a
git-author:
Sebastian Huber <sebastian.huber@…> (08/26/13 12:27:52)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/27/13 08:48:16)
Message:

score: Add and use CHAIN_INITIALIZER_ONE_NODE().

Add and use CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN(),
RTEMS_CHAIN_INITIALIZER_ONE_NODE() and
RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN().

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/src/__usrenv.c

    rd56f76a r23de794d  
    219219
    220220rtems_filesystem_mount_table_entry_t rtems_filesystem_null_mt_entry = {
    221   .location_chain = {
    222     .Head = {
    223       .Node = {
    224         .next = &rtems_filesystem_global_location_null.location.mt_entry_node,
    225         .previous = NULL
    226       },
    227       .fill = &rtems_filesystem_global_location_null.location.mt_entry_node,
    228     }
    229   },
     221  .location_chain = RTEMS_CHAIN_INITIALIZER_ONE_NODE(
     222    &rtems_filesystem_global_location_null.location.mt_entry_node
     223  ),
    230224  .ops = &null_ops,
    231225  .mt_point_node = &rtems_filesystem_global_location_null,
     
    237231rtems_filesystem_global_location_t rtems_filesystem_global_location_null = {
    238232  .location = {
    239     .mt_entry_node = {
    240       .next = &rtems_filesystem_null_mt_entry.location_chain.Tail.Node,
    241       .previous = &rtems_filesystem_null_mt_entry.location_chain.Head.Node
    242     },
     233    .mt_entry_node = RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN(
     234      &rtems_filesystem_null_mt_entry.location_chain
     235    ),
    243236    .handlers = &rtems_filesystem_null_handlers,
    244237    .mt_entry = &rtems_filesystem_null_mt_entry
  • cpukit/sapi/include/rtems/chain.h

    rd56f76a r23de794d  
    4444#define RTEMS_CHAIN_INITIALIZER_EMPTY(name) \
    4545  CHAIN_INITIALIZER_EMPTY(name)
     46
     47/**
     48 *  @brief Chain initializer for a chain with one @a node.
     49 *
     50 *  @see RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN().
     51 */
     52#define RTEMS_CHAIN_INITIALIZER_ONE_NODE( node ) \
     53  CHAIN_INITIALIZER_ONE_NODE( node )
     54
     55/**
     56 *  @brief Chain node initializer for a @a chain containing exactly this node.
     57 *
     58 *  @see RTEMS_CHAIN_INITIALIZER_ONE_NODE().
     59 */
     60#define RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( chain ) \
     61  CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( chain )
    4662
    4763/**
  • cpukit/score/include/rtems/score/chainimpl.h

    rd56f76a r23de794d  
    3636#define CHAIN_INITIALIZER_EMPTY(name) \
    3737  { { { &(name).Tail.Node, NULL }, &(name).Head.Node } }
     38
     39/**
     40 *  @brief Chain initializer for a chain with one @a node.
     41 *
     42 *  @see CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN().
     43 */
     44#define CHAIN_INITIALIZER_ONE_NODE( node ) \
     45  { { { (node), NULL }, (node) } }
     46
     47/**
     48 *  @brief Chain node initializer for a @a chain containing exactly this node.
     49 *
     50 *  @see CHAIN_INITIALIZER_ONE_NODE().
     51 */
     52#define CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( chain ) \
     53  { &(chain)->Tail.Node, &(chain)->Head.Node }
    3854
    3955/**
  • testsuites/sptests/spchain/init.c

    rd56f76a r23de794d  
    2626} test_node;
    2727
     28static rtems_chain_control one_node_chain;
     29
     30static rtems_chain_node node_of_one_node_chain =
     31  RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( &one_node_chain );
     32
     33static rtems_chain_control one_node_chain =
     34  RTEMS_CHAIN_INITIALIZER_ONE_NODE( &node_of_one_node_chain );
     35
    2836static void test_chain_control_initializer(void)
    2937{
    3038  rtems_chain_control chain = RTEMS_CHAIN_INITIALIZER_EMPTY( chain );
     39
    3140  puts( "INIT - Verify rtems_chain_control initializer" );
     41
    3242  rtems_test_assert( rtems_chain_is_empty( &chain ) );
     43
     44  rtems_test_assert( rtems_chain_has_only_one_node( &one_node_chain ) );
     45  rtems_test_assert(
     46    rtems_chain_immutable_first( &one_node_chain ) == &node_of_one_node_chain
     47  );
     48  rtems_test_assert(
     49    rtems_chain_immutable_last( &one_node_chain ) == &node_of_one_node_chain
     50  );
     51  rtems_test_assert(
     52    rtems_chain_immutable_head( &one_node_chain )
     53      == rtems_chain_immutable_previous( &node_of_one_node_chain )
     54  );
     55  rtems_test_assert(
     56    rtems_chain_immutable_tail( &one_node_chain )
     57      == rtems_chain_immutable_next( &node_of_one_node_chain )
     58  );
    3359}
    3460
Note: See TracChangeset for help on using the changeset viewer.