summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/regiongetinfo.c
diff options
context:
space:
mode:
authorGlenn Humphrey <glenn.humphrey@oarcorp.com>2007-11-27 17:38:11 +0000
committerGlenn Humphrey <glenn.humphrey@oarcorp.com>2007-11-27 17:38:11 +0000
commit5700b804e2443135a07c6ff5f65a024e7be412fd (patch)
tree8177dd1b95bd7698eac495c8403c6bf7828e2cf3 /cpukit/rtems/src/regiongetinfo.c
parent2007-11-27 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-5700b804e2443135a07c6ff5f65a024e7be412fd.tar.bz2
2007-11-27 Glenn Humphrey <glenn.humphrey@OARcorp.com>
* rtems/src/regioncreate.c, rtems/src/regiondelete.c, rtems/src/regionextend.c, rtems/src/regiongetfreeinfo.c, rtems/src/regiongetinfo.c, rtems/src/regiongetsegment.c, rtems/src/regiongetsegmentsize.c, rtems/src/regionresizesegment.c, rtems/src/regionreturnsegment.c: Restructed to move the OBJECTS_LOCAL case to the top of the switch statement, have a single exit with one call to _RTEMS_Unlock_allocator and eliminate the fall-through return of RTEMS_INTERNAL_ERROR. These changes produced simplier assembly code and allowed for complete test coverage.
Diffstat (limited to 'cpukit/rtems/src/regiongetinfo.c')
-rw-r--r--cpukit/rtems/src/regiongetinfo.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/cpukit/rtems/src/regiongetinfo.c b/cpukit/rtems/src/regiongetinfo.c
index 9843338b0a..2fad55dcff 100644
--- a/cpukit/rtems/src/regiongetinfo.c
+++ b/cpukit/rtems/src/regiongetinfo.c
@@ -47,35 +47,36 @@ rtems_status_code rtems_region_get_information(
Heap_Information_block *the_info
)
{
- register Region_Control *the_region;
Objects_Locations location;
+ rtems_status_code return_status = RTEMS_INTERNAL_ERROR;
+ register Region_Control *the_region;
if ( !the_info )
return RTEMS_INVALID_ADDRESS;
_RTEMS_Lock_allocator();
- the_region = _Region_Get( id, &location );
- switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE: /* this error cannot be returned */
- _RTEMS_Unlock_allocator();
- return RTEMS_INTERNAL_ERROR;
-#endif
- case OBJECTS_ERROR:
- _RTEMS_Unlock_allocator();
- return RTEMS_INVALID_ID;
+ the_region = _Region_Get( id, &location );
+ switch ( location ) {
- case OBJECTS_LOCAL:
+ case OBJECTS_LOCAL:
+ if ( _Heap_Get_information( &the_region->Memory, the_info ) !=
+ HEAP_GET_INFORMATION_SUCCESSFUL )
+ return_status = RTEMS_INVALID_ADDRESS;
+ else
+ return_status = RTEMS_SUCCESSFUL;
+ break;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ break;
+#endif
- if ( _Heap_Get_information( &the_region->Memory, the_info ) ==
- HEAP_GET_INFORMATION_SUCCESSFUL ) {
- _RTEMS_Unlock_allocator();
- return RTEMS_SUCCESSFUL;
- }
- _RTEMS_Unlock_allocator();
- return RTEMS_INVALID_ADDRESS;
- }
+ case OBJECTS_ERROR:
+ return_status = RTEMS_INVALID_ID;
+ break;
+ }
- return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+ _RTEMS_Unlock_allocator();
+ return return_status;
}