[PATCH] Remove superfluous run-time check

Joel Sherrill joel at rtems.org
Fri Apr 5 14:40:32 UTC 2019


Are you sure it can't be NULL when POSIX is disabled? The historical case
where it was NULL was when you disabled an API.

If it truly can't be NULL now, it would be good to see comments that
explain why it can't be NULL.

On Fri, Apr 5, 2019 at 3:00 AM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> The _Objects_Information_table[ the_api ] is never NULL for a valid API
> index.
> ---
>  cpukit/posix/src/killinfo.c      | 8 +-------
>  cpukit/score/src/threaditerate.c | 5 +----
>  2 files changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/cpukit/posix/src/killinfo.c b/cpukit/posix/src/killinfo.c
> index 0031b7bdd8..742f9fb2c1 100644
> --- a/cpukit/posix/src/killinfo.c
> +++ b/cpukit/posix/src/killinfo.c
> @@ -196,13 +196,7 @@ int _POSIX_signals_Send(
>    interested_priority = UINT64_MAX;
>
>    for (the_api = OBJECTS_CLASSIC_API; the_api <= OBJECTS_APIS_LAST;
> the_api++) {
> -
> -    /*
> -     *  This can occur when no one is interested and an API is not
> configured.
> -     */
> -    if ( !_Objects_Information_table[ the_api ] )
> -      continue;
> -
> +    _Assert( _Objects_Information_table[ the_api ] != NULL );
>      the_info = _Objects_Information_table[ the_api ][ 1 ];
>      if ( !the_info )
>        continue;
> diff --git a/cpukit/score/src/threaditerate.c
> b/cpukit/score/src/threaditerate.c
> index 8d1614ab9b..78ccb6756c 100644
> --- a/cpukit/score/src/threaditerate.c
> +++ b/cpukit/score/src/threaditerate.c
> @@ -30,10 +30,7 @@ void _Thread_Iterate(
>      Objects_Maximum            maximum;
>      Objects_Maximum            index;
>
> -    if ( _Objects_Information_table[ api_index ] == NULL ) {
> -      continue;
> -    }
> -
> +    _Assert( _Objects_Information_table[ api_index ] != NULL );
>      information = _Objects_Information_table[ api_index ][ 1 ];
>
>      if ( information == NULL ) {
> --
> 2.16.4
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20190405/c8312c7d/attachment-0002.html>


More information about the devel mailing list