Changeset e094261 in rtems


Ignore:
Timestamp:
07/13/22 13:14:47 (20 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
3bb79aab
Parents:
1e360d3
git-author:
Sebastian Huber <sebastian.huber@…> (07/13/22 13:14:47)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/18/22 07:33:16)
Message:

score: Fix _Objects_Active_count()

With unlimited objects the object maximum may be larger than the sum of active
and inactive objects.

Update #4677.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/objectactivecount.c

    r1e360d3 re094261  
    4747)
    4848{
    49   Objects_Maximum inactive;
    50   Objects_Maximum maximum;
     49  Objects_Maximum   active;
     50  Objects_Maximum   index;
     51  Objects_Maximum   maximum;
     52  Objects_Control **local_table;
    5153
    5254  _Assert( _Objects_Allocator_is_owner() );
    5355
    54   inactive = (Objects_Maximum)
    55     _Chain_Node_count_unprotected( &information->Inactive );
     56  active = 0;
    5657  maximum  = _Objects_Get_maximum_index( information );
     58  local_table = information->local_table;
    5759
    58   return maximum - inactive;
     60  for ( index = 0; index < maximum; ++index ) {
     61    if ( local_table[ index ] != NULL ) {
     62      ++active;
     63    }
     64  }
     65
     66  return active;
    5967}
Note: See TracChangeset for help on using the changeset viewer.