[PATCH 16/20] score: Optimize _Objects_Get_no_protection()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Apr 19 13:12:44 UTC 2016


Make the id the first parameter since usual callers get the object
identifier as the first parameter themself.
---
 cpukit/posix/include/rtems/posix/keyimpl.h    | 2 +-
 cpukit/rtems/include/rtems/rtems/regionimpl.h | 2 +-
 cpukit/sapi/include/rtems/extensionimpl.h     | 2 +-
 cpukit/score/include/rtems/score/objectimpl.h | 8 +++++---
 cpukit/score/src/objectgetnext.c              | 2 +-
 cpukit/score/src/objectgetnoprotection.c      | 4 ++--
 6 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/keyimpl.h b/cpukit/posix/include/rtems/posix/keyimpl.h
index 1f87470..833e652 100644
--- a/cpukit/posix/include/rtems/posix/keyimpl.h
+++ b/cpukit/posix/include/rtems/posix/keyimpl.h
@@ -77,7 +77,7 @@ RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free(
 RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get( pthread_key_t key )
 {
   return (POSIX_Keys_Control *)
-    _Objects_Get_no_protection( &_POSIX_Keys_Information, (Objects_Id) key );
+    _Objects_Get_no_protection( (Objects_Id) key, &_POSIX_Keys_Information );
 }
 
 RTEMS_INLINE_ROUTINE void _POSIX_Keys_Key_value_acquire(
diff --git a/cpukit/rtems/include/rtems/rtems/regionimpl.h b/cpukit/rtems/include/rtems/rtems/regionimpl.h
index 4db6599..e4dcff0 100644
--- a/cpukit/rtems/include/rtems/rtems/regionimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/regionimpl.h
@@ -73,7 +73,7 @@ RTEMS_INLINE_ROUTINE Region_Control *_Region_Get_and_lock( Objects_Id id )
   _RTEMS_Lock_allocator();
 
   the_region = (Region_Control *)
-    _Objects_Get_no_protection( &_Region_Information, id );
+    _Objects_Get_no_protection( id, &_Region_Information );
 
   if ( the_region != NULL ) {
     /* Keep allocator lock */
diff --git a/cpukit/sapi/include/rtems/extensionimpl.h b/cpukit/sapi/include/rtems/extensionimpl.h
index 64ac600..fb4eeaf 100644
--- a/cpukit/sapi/include/rtems/extensionimpl.h
+++ b/cpukit/sapi/include/rtems/extensionimpl.h
@@ -42,7 +42,7 @@ RTEMS_INLINE_ROUTINE void _Extension_Free (
 RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Get( Objects_Id id )
 {
   return (Extension_Control *)
-    _Objects_Get_no_protection( &_Extension_Information, id );
+    _Objects_Get_no_protection( id, &_Extension_Information );
 }
 
 #ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h
index 6877b8e..fb45977 100644
--- a/cpukit/score/include/rtems/score/objectimpl.h
+++ b/cpukit/score/include/rtems/score/objectimpl.h
@@ -656,8 +656,10 @@ Objects_Control *_Objects_Get_local(
  *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
  *  and the_object is undefined.
  *
- *  @param[in] information points to an object class information block.
  *  @param[in] id is the Id of the object whose name we are locating.
+ *    This is the first parameter since usual callers get the object identifier
+ *    as the first parameter themself.
+ *  @param[in] information points to an object class information block.
  *
  *  @retval This method returns one of the values from the
  *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
@@ -670,8 +672,8 @@ Objects_Control *_Objects_Get_local(
  *  objects.
  */
 Objects_Control *_Objects_Get_no_protection(
-  const Objects_Information *information,
-  Objects_Id                 id
+  Objects_Id                 id,
+  const Objects_Information *information
 );
 
 /**
diff --git a/cpukit/score/src/objectgetnext.c b/cpukit/score/src/objectgetnext.c
index 2d4f252..a46c02f 100644
--- a/cpukit/score/src/objectgetnext.c
+++ b/cpukit/score/src/objectgetnext.c
@@ -52,7 +52,7 @@ Objects_Control *_Objects_Get_next(
         }
 
         /* try to grab one */
-        the_object = _Objects_Get_no_protection( information, next_id );
+        the_object = _Objects_Get_no_protection( next_id, information );
 
         next_id++;
 
diff --git a/cpukit/score/src/objectgetnoprotection.c b/cpukit/score/src/objectgetnoprotection.c
index eaa172c..8569223 100644
--- a/cpukit/score/src/objectgetnoprotection.c
+++ b/cpukit/score/src/objectgetnoprotection.c
@@ -21,8 +21,8 @@
 #include <rtems/score/objectimpl.h>
 
 Objects_Control *_Objects_Get_no_protection(
-  const Objects_Information *information,
-  Objects_Id                 id
+  Objects_Id                 id,
+  const Objects_Information *information
 )
 {
   Objects_Control *the_object;
-- 
1.8.4.5




More information about the devel mailing list