diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-11-22 06:38:42 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-12-07 14:22:01 +0100 |
commit | 359a3a36ca9bf82054fe6a83bd97868c310e5aae (patch) | |
tree | 431e2a12d7950abe39bc63e55d862232c0a3ce4e /cpukit/score/src/objectfree.c | |
parent | score: Rename Objects_Information::size (diff) | |
download | rtems-359a3a36ca9bf82054fe6a83bd97868c310e5aae.tar.bz2 |
score: Rename Objects_Information::allocation_size
Rename Objects_Information::allocation_size in
Objects_Information::objects_per_block. Adjust integer types in
_Objects_Shrink_information() and _Objects_Free().
Update #3621.
Diffstat (limited to 'cpukit/score/src/objectfree.c')
-rw-r--r-- | cpukit/score/src/objectfree.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/cpukit/score/src/objectfree.c b/cpukit/score/src/objectfree.c index 30ea1e36e5..3e7c8e409c 100644 --- a/cpukit/score/src/objectfree.c +++ b/cpukit/score/src/objectfree.c @@ -27,28 +27,32 @@ void _Objects_Free( Objects_Control *the_object ) { - uint32_t allocation_size = information->allocation_size; - _Assert( _Objects_Allocator_is_owner() ); _Chain_Append_unprotected( &information->Inactive, &the_object->Node ); if ( information->auto_extend ) { - uint32_t block; + Objects_Maximum objects_per_block; + Objects_Maximum block; + Objects_Maximum inactive; + + objects_per_block = information->objects_per_block; + block = _Objects_Get_index( the_object->id ); + block -= _Objects_Get_index( information->minimum_id ); + block /= objects_per_block; - block = (uint32_t) (_Objects_Get_index( the_object->id ) - - _Objects_Get_index( information->minimum_id )); - block /= information->allocation_size; + ++information->inactive_per_block[ block ]; - information->inactive_per_block[ block ]++; - information->inactive++; + inactive = information->inactive; + ++inactive; + information->inactive = inactive; /* * Check if the threshold level has been met of - * 1.5 x allocation_size are free. + * 1.5 x objects_per_block are free. */ - if ( information->inactive > ( allocation_size + ( allocation_size >> 1 ) ) ) { + if ( inactive > ( objects_per_block + ( objects_per_block >> 1 ) ) ) { _Objects_Shrink_information( information ); } } |