[rtems commit] posix: Convert to inline function

Sebastian Huber sebh at rtems.org
Thu Jul 18 07:54:30 UTC 2013


Module:    rtems
Branch:    master
Commit:    9728ef357fbc3eada1c503f9218778ac445042a5
Changeset: http://git.rtems.org/rtems/commit/?id=9728ef357fbc3eada1c503f9218778ac445042a5

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jul 17 15:05:56 2013 +0200

posix: Convert to inline function

---

 cpukit/posix/include/rtems/posix/muteximpl.h |   20 ++++++++++++++++----
 cpukit/posix/src/mutextranslatereturncode.c  |   22 +---------------------
 2 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/muteximpl.h b/cpukit/posix/include/rtems/posix/muteximpl.h
index d4673aa..29e93c2 100644
--- a/cpukit/posix/include/rtems/posix/muteximpl.h
+++ b/cpukit/posix/include/rtems/posix/muteximpl.h
@@ -18,6 +18,8 @@
 #include <rtems/posix/mutex.h>
 #include <rtems/score/coremuteximpl.h>
 
+#include <errno.h>
+
 #ifndef _RTEMS_POSIX_MUTEXIMPL_H
 #define _RTEMS_POSIX_MUTEXIMPL_H
 
@@ -38,6 +40,8 @@ POSIX_EXTERN Objects_Information  _POSIX_Mutex_Information;
 
 POSIX_EXTERN pthread_mutexattr_t _POSIX_Mutex_Default_attributes;
 
+extern const int _POSIX_Mutex_Return_codes[CORE_MUTEX_STATUS_LAST + 1];
+
 /*
  *  @brief POSIX Mutex Manager Initialization
  *
@@ -144,11 +148,19 @@ int _POSIX_Mutex_Lock_support(
  * willing to block but the operation was unable to complete within the time
  * allotted because the resource never became available.
  */
-
-int _POSIX_Mutex_Translate_core_mutex_return_code(
+RTEMS_INLINE_ROUTINE int _POSIX_Mutex_Translate_core_mutex_return_code(
   CORE_mutex_Status  the_mutex_status
-);
-
+)
+{
+  /*
+   *  Internal consistency check for bad status from SuperCore
+   */
+  #if defined(RTEMS_DEBUG)
+    if ( the_mutex_status > CORE_MUTEX_STATUS_LAST )
+      return EINVAL;
+  #endif
+  return _POSIX_Mutex_Return_codes[the_mutex_status];
+}
 
 /*
  *  _POSIX_Mutex_Get
diff --git a/cpukit/posix/src/mutextranslatereturncode.c b/cpukit/posix/src/mutextranslatereturncode.c
index aa2fb80..29069a0 100644
--- a/cpukit/posix/src/mutextranslatereturncode.c
+++ b/cpukit/posix/src/mutextranslatereturncode.c
@@ -18,14 +18,9 @@
 #include "config.h"
 #endif
 
-#include <pthread.h>
-#include <errno.h>
-
-#include <rtems/system.h>
-#include <rtems/score/coremutex.h>
 #include <rtems/posix/muteximpl.h>
 
-static int _POSIX_Mutex_Return_codes[CORE_MUTEX_STATUS_LAST + 1] = {
+const int _POSIX_Mutex_Return_codes[CORE_MUTEX_STATUS_LAST + 1] = {
   0,                      /* CORE_MUTEX_STATUS_SUCCESSFUL */
   EBUSY,                  /* CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT */
   EDEADLK,                /* CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED */
@@ -37,18 +32,3 @@ static int _POSIX_Mutex_Return_codes[CORE_MUTEX_STATUS_LAST + 1] = {
 #endif
   EINVAL                  /* CORE_MUTEX_STATUS_CEILING_VIOLATED */
 };
-
-
-int _POSIX_Mutex_Translate_core_mutex_return_code(
-  CORE_mutex_Status  the_mutex_status
-)
-{
-  /*
-   *  Internal consistency check for bad status from SuperCore
-   */
-  #if defined(RTEMS_DEBUG)
-    if ( the_mutex_status > CORE_MUTEX_STATUS_LAST )
-      return EINVAL;
-  #endif
-  return _POSIX_Mutex_Return_codes[the_mutex_status];
-}




More information about the vc mailing list