diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-10-10 15:19:15 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-10-10 15:19:15 +0000 |
commit | 681d452637e1500deaae084954e9fa702b9d347d (patch) | |
tree | 17dd97f56658bf3107b306e970b947bd60a8fccb /cpukit | |
parent | 2009-10-10 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-681d452637e1500deaae084954e9fa702b9d347d.tar.bz2 |
2009-10-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* score/inline/rtems/score/object.inl: _Objects_Get_local_object() is
only called from places where the index is known to be valid.
_Objects_Set_local_object() already assumed this. Eliminates
unreachable code.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 7 | ||||
-rw-r--r-- | cpukit/score/inline/rtems/score/object.inl | 13 |
2 files changed, 17 insertions, 3 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 5f2c1f1775..9c8ecca27f 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,5 +1,12 @@ 2009-10-10 Joel Sherrill <joel.sherrill@oarcorp.com> + * score/inline/rtems/score/object.inl: _Objects_Get_local_object() is + only called from places where the index is known to be valid. + _Objects_Set_local_object() already assumed this. Eliminates + unreachable code. + +2009-10-10 Joel Sherrill <joel.sherrill@oarcorp.com> + * rtems/src/timerserver.c: Indentation. 2009-10-10 Joel Sherrill <joel.sherrill@oarcorp.com> diff --git a/cpukit/score/inline/rtems/score/object.inl b/cpukit/score/inline/rtems/score/object.inl index ced5e75a9d..7db87bdde9 100644 --- a/cpukit/score/inline/rtems/score/object.inl +++ b/cpukit/score/inline/rtems/score/object.inl @@ -198,15 +198,22 @@ RTEMS_INLINE_ROUTINE bool _Objects_Are_ids_equal( * @param[in] index is the index of the object the caller wants to access * * @return This method returns a pointer to a local object or NULL if the - * index is invalid. + * index is invalid and RTEMS_DEBUG is enabled. */ RTEMS_INLINE_ROUTINE Objects_Control *_Objects_Get_local_object( Objects_Information *information, uint16_t index ) { - if ( index > information->maximum ) - return NULL; + /* + * This routine is ONLY to be called from places in the code + * where the Id is known to be good. Therefore, this should NOT + * occur in normal situations. + */ + #if defined(RTEMS_DEBUG) + if ( index > information->maximum ) + return NULL; + #endif return information->local_table[ index ]; } |