diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-01-20 17:08:19 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-01-20 17:08:19 +0000 |
commit | f659921bd277d06fea055a6830a7c870abc80e0e (patch) | |
tree | b5780263d4a51cd6eced749c956b49e46d99ffb2 /cpukit/score/src/objectextendinformation.c | |
parent | 2010-01-20 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-f659921bd277d06fea055a6830a7c870abc80e0e.tar.bz2 |
2010-01-20 Joel Sherrill <joel.sherrill@oarcorp.com>
Coverity Id 5
* score/src/objectextendinformation.c: Check object_blocks for NULL to
determine when to allocate object block table.
Diffstat (limited to '')
-rw-r--r-- | cpukit/score/src/objectextendinformation.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/cpukit/score/src/objectextendinformation.c b/cpukit/score/src/objectextendinformation.c index f8e19cf130..c56a8311eb 100644 --- a/cpukit/score/src/objectextendinformation.c +++ b/cpukit/score/src/objectextendinformation.c @@ -61,12 +61,12 @@ void _Objects_Extend_information( * Search for a free block of indexes. The block variable ends up set * to block_count + 1 if the table needs to be extended. */ - minimum_index = _Objects_Get_index( information->minimum_id ); index_base = minimum_index; block = 0; - if ( information->maximum < minimum_index ) + /* if ( information->maximum < minimum_index ) */ + if ( information->object_blocks == NULL ) block_count = 0; else { block_count = information->maximum / information->allocation_size; @@ -94,7 +94,6 @@ void _Objects_Extend_information( * Allocate the name table, and the objects and if it fails either return or * generate a fatal error depending on auto-extending being active. */ - block_size = information->allocation_size * information->size; if ( information->auto_extend ) { new_object_block = _Workspace_Allocate( block_size ); @@ -107,7 +106,6 @@ void _Objects_Extend_information( /* * If the index_base is the maximum we need to grow the tables. */ - if (index_base >= information->maximum ) { ISR_Level level; void **object_blocks; @@ -136,13 +134,11 @@ void _Objects_Extend_information( /* * Up the block count and maximum */ - block_count++; /* * Allocate the tables and break it up. */ - block_size = block_count * (sizeof(void *) + sizeof(uint32_t) + sizeof(Objects_Name *)) + ((maximum + minimum_index) * sizeof(Objects_Control *)); @@ -156,7 +152,6 @@ void _Objects_Extend_information( /* * Break the block into the various sections. */ - inactive_per_block = (uint32_t *) _Addresses_Add_offset( object_blocks, block_count * sizeof(void*) ); local_table = (Objects_Control **) _Addresses_Add_offset( @@ -166,7 +161,6 @@ void _Objects_Extend_information( * Take the block count down. Saves all the (block_count - 1) * in the copies. */ - block_count--; if ( information->maximum > minimum_index ) { @@ -185,8 +179,7 @@ void _Objects_Extend_information( memcpy( local_table, information->local_table, (information->maximum + minimum_index) * sizeof(Objects_Control *) ); - } - else { + } else { /* * Deal with the special case of the 0 to minimum_index @@ -199,7 +192,6 @@ void _Objects_Extend_information( /* * Initialise the new entries in the table. */ - object_blocks[block_count] = NULL; inactive_per_block[block_count] = 0; @@ -235,13 +227,11 @@ void _Objects_Extend_information( /* * Assign the new object block to the object block table. */ - information->object_blocks[ block ] = new_object_block; /* * Initialize objects .. add to a local chain first. */ - _Chain_Initialize( &Inactive, information->object_blocks[ block ], @@ -252,10 +242,9 @@ void _Objects_Extend_information( /* * Move from the local chain, initialise, then append to the inactive chain */ - index = index_base; - while ( (the_object = (Objects_Control *) _Chain_Get( &Inactive ) ) != NULL ) { + while ((the_object = (Objects_Control *) _Chain_Get( &Inactive )) != NULL ) { the_object->id = _Objects_Build_id( information->the_api, |