Changeset f59f2fe9 in rtems


Ignore:
Timestamp:
Jun 25, 2015, 4:50:04 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
372bee84
Parents:
fdb45d6
git-author:
Sebastian Huber <sebastian.huber@…> (06/25/15 04:50:04)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/01/15 06:24:45)
Message:

score: Accept NULL pointer in _Freechain_Put()

With this a _Freechain_Put( _Freechain_Get() ) works always.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/freechain.h

    rfdb45d6 rf59f2fe9  
    9494 *
    9595 * @param[in] freechain The freechain control.
    96  * @param[in] node The node to put back.
     96 * @param[in] node The node to put back.  The node may be @c NULL, in this case
     97 *   the function does nothing.
    9798 */
    9899void _Freechain_Put(
  • cpukit/score/src/freechain.c

    rfdb45d6 rf59f2fe9  
    7575void _Freechain_Put( Freechain_Control *freechain, void *node )
    7676{
    77   _Chain_Prepend_unprotected( &freechain->Free, node );
     77  if ( node != NULL ) {
     78    _Chain_Prepend_unprotected( &freechain->Free, node );
     79  }
    7880}
  • testsuites/sptests/spfreechain01/init.c

    rfdb45d6 rf59f2fe9  
    4141    /* check whether freechain put and get works correctly*/
    4242
     43    _Freechain_Put(&fc, NULL);
     44
    4345    puts( "INIT - Get node from freechain - OK" );
    4446    node = _Freechain_Get(&fc, malloc, 1, sizeof(test_node));
Note: See TracChangeset for help on using the changeset viewer.