mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 23:23:13 +00:00
score: Fix _Objects_Active_count()
With unlimited objects the object maximum may be larger than the sum of active and inactive objects. Update #4676.
This commit is contained in:
@@ -24,14 +24,22 @@ Objects_Maximum _Objects_Active_count(
|
|||||||
const Objects_Information *information
|
const Objects_Information *information
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Objects_Maximum inactive;
|
Objects_Maximum active;
|
||||||
Objects_Maximum maximum;
|
Objects_Maximum index;
|
||||||
|
Objects_Maximum maximum;
|
||||||
|
Objects_Control **local_table;
|
||||||
|
|
||||||
_Assert( _Objects_Allocator_is_owner() );
|
_Assert( _Objects_Allocator_is_owner() );
|
||||||
|
|
||||||
inactive = (Objects_Maximum)
|
active = 0;
|
||||||
_Chain_Node_count_unprotected( &information->Inactive );
|
|
||||||
maximum = _Objects_Get_maximum_index( information );
|
maximum = _Objects_Get_maximum_index( information );
|
||||||
|
local_table = information->local_table;
|
||||||
|
|
||||||
return maximum - inactive;
|
for ( index = 0; index < maximum; ++index ) {
|
||||||
|
if ( local_table[ index ] != NULL ) {
|
||||||
|
++active;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return active;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user