2009-07-07 Chris Johns <chrisj@rtems.org>

* score/src/objectshrinkinformation.c: Rework loop to simplify and
	remove dead code.
This commit is contained in:
Joel Sherrill
2009-07-07 22:47:03 +00:00
parent 33a538113c
commit bc93f30f39
2 changed files with 22 additions and 33 deletions

View File

@@ -1,3 +1,8 @@
2009-07-07 Chris Johns <chrisj@rtems.org>
* score/src/objectshrinkinformation.c: Rework loop to simplify and
remove dead code.
2009-07-07 Joel Sherrill <joel.sherrill@OARcorp.com>
* ChangeLog, posix/src/mutexsetprioceiling.c: Remove warning.

View File

@@ -59,47 +59,31 @@ void _Objects_Shrink_information(
*/
index_base = _Objects_Get_index( information->minimum_id );
block_count = ( information->maximum - index_base ) / information->allocation_size;
block_count = (information->maximum - index_base) /
information->allocation_size;
for ( block = 0; block < block_count; block++ ) {
if ( information->inactive_per_block[ block ] == information->allocation_size ) {
/*
* XXX - Not to sure how to use a chain where you need to iterate and
* and remove elements.
*/
the_object = (Objects_Control *) information->Inactive.first;
if ( information->inactive_per_block[ block ] ==
information->allocation_size ) {
/*
* Assume the Inactive chain is never empty at this point
*/
the_object = (Objects_Control *) information->Inactive.first;
do {
index = _Objects_Get_index( the_object->id );
if ((index >= index_base) &&
(index < (index_base + information->allocation_size))) {
/*
* Get the next node before the node is extracted
*/
extract_me = the_object;
if ( !_Chain_Is_last( &the_object->Node ) )
the_object = (Objects_Control *) the_object->Node.next;
else
the_object = NULL;
_Chain_Extract( &extract_me->Node );
}
else {
the_object = (Objects_Control *) the_object->Node.next;
}
}
while ( the_object && !_Chain_Is_last( &the_object->Node ) );
index = _Objects_Get_index( the_object->id );
/*
* Get the next node before the node is extracted
*/
extract_me = the_object;
the_object = (Objects_Control *) the_object->Node.next;
if ((index >= index_base) &&
(index < (index_base + information->allocation_size))) {
_Chain_Extract( &extract_me->Node );
}
}
while ( the_object );
/*
* Free the memory and reset the structures in the object' information
*/