[PATCH] Remove *_Is_null() inline functions
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Oct 13 11:49:45 UTC 2020
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 11ebdca322..25ea0b23b7 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 8e8efe5de5..90910cabc4 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 15bce3668c..2d78c4ec6d 100644
--- a/cpukit/include/rtems/score/chainimpl.h
+++ b/cpukit/include/rtems/score/chainimpl.h
@@ -166,23 +166,6 @@ RTEMS_INLINE_ROUTINE bool _Chain_Are_nodes_equal(
return left == right;
}
-/**
- * @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.
*
diff --git a/cpukit/include/rtems/score/objectmp.h b/cpukit/include/rtems/score/objectmp.h
index c2621c3857..74a01de1a7 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 a2e1e1427c..9468d64df0 100644
--- a/cpukit/include/rtems/score/threadimpl.h
+++ b/cpukit/include/rtems/score/threadimpl.h
@@ -1071,21 +1071,6 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_context_switch_necessary( void )
return ( _Thread_Dispatch_necessary );
}
-/**
- * @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.
*
diff --git a/cpukit/rtems/src/msgmp.c b/cpukit/rtems/src/msgmp.c
index ae7c9802e2..9847cbd569 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 ac2b48aba4..99af7adf71 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 9b169a8e8f..849bb6e84a 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 f282314a31..5ace9642fb 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 36e23660a9..ea649da57f 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 9b1fdec3ae..84e59552c6 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 74d55305a9..612fdacca0 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 );
}
--
2.26.2
More information about the devel
mailing list