[PATCH 1/5] score: Add rtems_set_errno_and_return_value()

Gedare Bloom gedare at rtems.org
Mon Mar 9 14:52:55 UTC 2015


Does it make sense to provide
rtems_set_errno_and_return_cast_value(_error, _cast_type,
_value)...and replace the other two macros in seterr.h?

On Mon, Mar 9, 2015 at 8:18 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> ---
>  cpukit/score/include/rtems/seterr.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/cpukit/score/include/rtems/seterr.h b/cpukit/score/include/rtems/seterr.h
> index 1e9e0d0..a3a977d 100644
> --- a/cpukit/score/include/rtems/seterr.h
> +++ b/cpukit/score/include/rtems/seterr.h
> @@ -51,6 +51,16 @@
>  #define rtems_set_errno_and_return_minus_one_cast( _error, _cast ) \
>    do { errno = (_error); return (_cast) -1; } while(0)
>
> +/**
> + *  This is a helper macro which will set the variable errno and return
> + *  the specified value to the caller.
> + *
> + *  @param[in] _error is the error code
> + *  @param[in] _value is the value to return
> + */
> +#define rtems_set_errno_and_return_value( _error, _value ) \
> +  do { errno = (_error); return (_value); } while(0)
> +
>  /**@}*/
>  #endif
>  /* end of include file */
> --
> 1.8.4.5
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



More information about the devel mailing list