diff options
Diffstat (limited to 'cpukit/score/src/objectshrinkinformation.c')
-rw-r--r-- | cpukit/score/src/objectshrinkinformation.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/cpukit/score/src/objectshrinkinformation.c b/cpukit/score/src/objectshrinkinformation.c index db085e1042..cf3618f8fa 100644 --- a/cpukit/score/src/objectshrinkinformation.c +++ b/cpukit/score/src/objectshrinkinformation.c @@ -27,9 +27,10 @@ void _Objects_Shrink_information( Objects_Information *information ) { - uint32_t block_count; - uint32_t block; - uint32_t index_base; + Objects_Maximum objects_per_block; + Objects_Maximum index_base; + Objects_Maximum block_count; + Objects_Maximum block; _Assert( _Objects_Allocator_is_owner() ); @@ -37,20 +38,26 @@ void _Objects_Shrink_information( * Search the list to find block or chunk with all objects inactive. */ + objects_per_block = information->objects_per_block; index_base = _Objects_Get_index( information->minimum_id ); - block_count = (information->maximum - index_base) / - information->allocation_size; + block_count = ( information->maximum - index_base ) / objects_per_block; for ( block = 0; block < block_count; block++ ) { - if ( information->inactive_per_block[ block ] == - information->allocation_size ) { - Chain_Node *node = _Chain_First( &information->Inactive ); - const Chain_Node *tail = _Chain_Immutable_tail( &information->Inactive ); - uint32_t index_end = index_base + information->allocation_size; + if ( information->inactive_per_block[ block ] == objects_per_block ) { + Chain_Node *node; + const Chain_Node *tail; + uint32_t index_end; + + node = _Chain_First( &information->Inactive ); + tail = _Chain_Immutable_tail( &information->Inactive ); + index_end = index_base + objects_per_block; while ( node != tail ) { - Objects_Control *object = (Objects_Control *) node; - uint32_t index = _Objects_Get_index( object->id ); + Objects_Control *object; + uint32_t index; + + object = (Objects_Control *) node; + index = _Objects_Get_index( object->id ); /* * Get the next node before the node is extracted @@ -70,11 +77,11 @@ void _Objects_Shrink_information( information->object_blocks[ block ] = NULL; information->inactive_per_block[ block ] = 0; - information->inactive -= information->allocation_size; + information->inactive -= objects_per_block; return; } - index_base += information->allocation_size; + index_base += objects_per_block; } } |