[rtems commit] Remove *_Is_null() inline functions

Sebastian Huber sebh at rtems.org
Thu Oct 15 17:11:45 UTC 2020


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Oct 13 13:47:06 2020 +0200

Remove *_Is_null() inline functions

Simply compare the values against NULL.

---

 cpukit/include/rtems/chain.h            |  2 +-
 cpukit/include/rtems/rtems/asrimpl.h    | 13 -------------
 cpukit/include/rtems/score/chainimpl.h  | 17 -----------------
 cpukit/include/rtems/score/objectmp.h   | 15 ---------------
 cpukit/include/rtems/score/threadimpl.h | 15 ---------------
 cpukit/rtems/src/msgmp.c                |  5 +++--
 cpukit/rtems/src/partmp.c               |  5 +++--
 cpukit/rtems/src/semmp.c                |  3 ++-
 cpukit/rtems/src/signalcatch.c          |  2 +-
 cpukit/rtems/src/signalsend.c           |  2 +-
 cpukit/rtems/src/taskconstruct.c        |  2 +-
 cpukit/score/src/objectmp.c             |  7 ++++---
 12 files changed, 16 insertions(+), 72 deletions(-)

diff --git a/cpukit/include/rtems/chain.h b/cpukit/include/rtems/chain.h
index 11ebdca..25ea0b2 100644
--- a/cpukit/include/rtems/chain.h
+++ b/cpukit/include/rtems/chain.h
@@ -234,7 +234,7 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_is_null_node(
   const rtems_chain_node *the_node
 )
 {
-  return _Chain_Is_null_node( the_node );
+  return the_node == NULL;
 }
 
 /**
diff --git a/cpukit/include/rtems/rtems/asrimpl.h b/cpukit/include/rtems/rtems/asrimpl.h
index 8e8efe5..90910ca 100644
--- a/cpukit/include/rtems/rtems/asrimpl.h
+++ b/cpukit/include/rtems/rtems/asrimpl.h
@@ -45,19 +45,6 @@ RTEMS_INLINE_ROUTINE void _ASR_Initialize (
   memset(asr, 0, sizeof(*asr));
 }
 
-/**
- *  @brief ASR_Is_null_handler
- *
- *  This function returns TRUE if the given asr_handler is NULL and
- *  FALSE otherwise.
- */
-RTEMS_INLINE_ROUTINE bool _ASR_Is_null_handler (
-  rtems_asr_entry asr_handler
-)
-{
-  return asr_handler == NULL;
-}
-
 RTEMS_INLINE_ROUTINE rtems_signal_set _ASR_Swap_signals( ASR_Information *asr )
 {
   rtems_signal_set new_signals_posted;
diff --git a/cpukit/include/rtems/score/chainimpl.h b/cpukit/include/rtems/score/chainimpl.h
index 15bce36..2d78c4e 100644
--- a/cpukit/include/rtems/score/chainimpl.h
+++ b/cpukit/include/rtems/score/chainimpl.h
@@ -167,23 +167,6 @@ RTEMS_INLINE_ROUTINE bool _Chain_Are_nodes_equal(
 }
 
 /**
- * @brief Checks if the chain node pointer is NULL.
- *
- * This function returns true if the_node is NULL and false otherwise.
- *
- * @param the_node The node pointer to check.
- *
- * @retval true @a the_node is @c NULL.
- * @retval false @a the_node is not @c NULL.
- */
-RTEMS_INLINE_ROUTINE bool _Chain_Is_null_node(
-  const Chain_Node *the_node
-)
-{
-  return (the_node == NULL);
-}
-
-/**
  * @brief Returns pointer to chain head.
  *
  * This function returns a pointer to the head node on the chain.
diff --git a/cpukit/include/rtems/score/objectmp.h b/cpukit/include/rtems/score/objectmp.h
index c2621c3..74a01de 100644
--- a/cpukit/include/rtems/score/objectmp.h
+++ b/cpukit/include/rtems/score/objectmp.h
@@ -190,21 +190,6 @@ Objects_MP_Control *_Objects_MP_Allocate_global_object( void );
  */
 void _Objects_MP_Free_global_object( Objects_MP_Control *the_object );
 
-/**
- * @brief Checks if the global object is NULL or not.
- *
- * @param the_object The object to check if it is NULL.
- *
- * @retval true @a the_object is NULL.
- * @retval false @a the_object is not NULL.
- */
-RTEMS_INLINE_ROUTINE bool _Objects_MP_Is_null_global_object (
-  Objects_MP_Control *the_object
-)
-{
-  return( the_object == NULL );
-}
-
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h
index a2e1e14..9468d64 100644
--- a/cpukit/include/rtems/score/threadimpl.h
+++ b/cpukit/include/rtems/score/threadimpl.h
@@ -1072,21 +1072,6 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_context_switch_necessary( void )
 }
 
 /**
- * @brief Checks if the thread is NULL.
- *
- * @param the_thread The thread for the verification.
- *
- * @retval true The thread is @c NULL.
- * @retval false The thread is not @c NULL.
- */
-RTEMS_INLINE_ROUTINE bool _Thread_Is_null (
-  const Thread_Control *the_thread
-)
-{
-  return ( the_thread == NULL );
-}
-
-/**
  * @brief Gets the maximum number of internal threads.
  *
  * @return The maximum number of internal threads.
diff --git a/cpukit/rtems/src/msgmp.c b/cpukit/rtems/src/msgmp.c
index ae7c980..9847cbd 100644
--- a/cpukit/rtems/src/msgmp.c
+++ b/cpukit/rtems/src/msgmp.c
@@ -397,8 +397,9 @@ static void _Message_queue_MP_Process_packet (
 
       the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
 
-      if (! _Thread_Is_null( the_thread ) )
-         _Thread_queue_Extract( the_thread );
+      if ( the_thread != NULL ) {
+        _Thread_queue_Extract( the_thread );
+      }
 
       _MPCI_Return_packet( the_packet_prefix );
       break;
diff --git a/cpukit/rtems/src/partmp.c b/cpukit/rtems/src/partmp.c
index ac2b48a..99af7ad 100644
--- a/cpukit/rtems/src/partmp.c
+++ b/cpukit/rtems/src/partmp.c
@@ -242,8 +242,9 @@ static void _Partition_MP_Process_packet(
 
       the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
 
-      if ( ! _Thread_Is_null( the_thread ) )
-         _Thread_queue_Extract( the_thread );
+      if ( the_thread != NULL ) {
+        _Thread_queue_Extract( the_thread );
+      }
 
       _MPCI_Return_packet( the_packet_prefix );
       break;
diff --git a/cpukit/rtems/src/semmp.c b/cpukit/rtems/src/semmp.c
index 9b169a8..849bb6e 100644
--- a/cpukit/rtems/src/semmp.c
+++ b/cpukit/rtems/src/semmp.c
@@ -222,8 +222,9 @@ static void _Semaphore_MP_Process_packet (
 
       the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
 
-      if ( ! _Thread_Is_null( the_thread ) )
+      if ( the_thread != NULL ) {
         _Thread_queue_Extract( the_thread );
+      }
 
       _MPCI_Return_packet( the_packet_prefix );
       break;
diff --git a/cpukit/rtems/src/signalcatch.c b/cpukit/rtems/src/signalcatch.c
index f282314..5ace964 100644
--- a/cpukit/rtems/src/signalcatch.c
+++ b/cpukit/rtems/src/signalcatch.c
@@ -77,7 +77,7 @@ rtems_status_code rtems_signal_catch(
   api = executing->API_Extensions[ THREAD_API_RTEMS ];
   asr = &api->Signal;
 
-  if ( !_ASR_Is_null_handler( asr_handler ) ) {
+  if ( asr_handler != NULL ) {
     asr->mode_set = mode_set;
     asr->handler = asr_handler;
   } else {
diff --git a/cpukit/rtems/src/signalsend.c b/cpukit/rtems/src/signalsend.c
index 36e2366..ea649da 100644
--- a/cpukit/rtems/src/signalsend.c
+++ b/cpukit/rtems/src/signalsend.c
@@ -53,7 +53,7 @@ rtems_status_code rtems_signal_send(
 
   _Thread_State_acquire_critical( the_thread, &lock_context );
 
-  if ( _ASR_Is_null_handler( asr->handler ) ) {
+  if ( asr->handler == NULL ) {
     _Thread_State_release( the_thread, &lock_context );
     return RTEMS_NOT_DEFINED;
   }
diff --git a/cpukit/rtems/src/taskconstruct.c b/cpukit/rtems/src/taskconstruct.c
index 9b1fdec..84e5955 100644
--- a/cpukit/rtems/src/taskconstruct.c
+++ b/cpukit/rtems/src/taskconstruct.c
@@ -180,7 +180,7 @@ rtems_status_code _RTEMS_tasks_Create(
   if ( is_global ) {
     the_global_object = _Objects_MP_Allocate_global_object();
 
-    if ( _Objects_MP_Is_null_global_object( the_global_object ) ) {
+    if ( the_global_object == NULL ) {
       _RTEMS_tasks_Free( the_thread );
       _Objects_Allocator_unlock();
       return RTEMS_TOO_MANY;
diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c
index 74d5530..612fdac 100644
--- a/cpukit/score/src/objectmp.c
+++ b/cpukit/score/src/objectmp.c
@@ -231,13 +231,14 @@ bool _Objects_MP_Allocate_and_open (
   bool                 is_fatal_error
 )
 {
-  Objects_MP_Control  *the_global_object;
+  Objects_MP_Control *the_global_object;
 
   the_global_object = _Objects_MP_Allocate_global_object();
-  if ( _Objects_MP_Is_null_global_object( the_global_object ) ) {
 
-    if ( is_fatal_error == false )
+  if ( the_global_object == NULL ) {
+    if ( !is_fatal_error ) {
       return false;
+    }
 
     _Internal_error( INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS );
   }



More information about the vc mailing list