Re: [spice-common 6/7] log: Introduce spice_assert_if_fail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>



On Fri, 2015-11-27 at 16:47 +0100, Christophe Fergeau wrote:
> They can be used in spice-server to replace spice_return_if_fail.
> Currently spice_return_if_fail aborts in spice-server, and it's not
> always clear whether using a non-aborting g_return_if_fail is acceptable
> or not. Having a spice_assert_if_fail alternative makes it clearer that
> this is not going to return, while having a name distinct from assert()
> so that places which needs reviewing can be spotted more easily.
> ---
>  common/log.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/common/log.h b/common/log.h
> index 2731582..411acf1 100644
> --- a/common/log.h
> +++ b/common/log.h
> @@ -95,7 +95,10 @@ void spice_log(const char *log_domain,
>      }                                                   \
>  } G_STMT_END
>  
> -#define spice_assert(x) G_STMT_START {              \
> +#define spice_assert_val_if_fail(cond, val) spice_assert(cond)
> +#define spice_assert_if_fail(cond) spice_assert(cond)
> +
> +#define spice_assert(x) G_STMT_START {                  \
>      if SPICE_LIKELY(x) { } else {                       \
>          spice_error("assertion `%s' failed", #x);       \
>      }                                                   \
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]