On Fri, Mar 29, 2019 at 11:30:46AM +0100, Christophe Fergeau wrote:
> Without the added abort(), it cannot know g_log(G_LOG_LEVEL_CRITICAL)
> will never return.
>
> Signed-off-by: Christophe Fergeau <[email protected]>
> ---
> common/log.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/common/log.h b/common/log.h
> index 7c67e7a..1482358 100644
> --- a/common/log.h
> +++ b/common/log.h
> @@ -20,6 +20,7 @@
>
> #include <stdarg.h>
> #include <stdio.h>
> +#include <stdlib.h>
> #include <glib.h>
> #include <spice/macros.h>
>
> @@ -42,6 +43,7 @@ void spice_log(GLogLevelFlags log_level,
> #define spice_return_if_fail(x) G_STMT_START { \
> if G_LIKELY(x) { } else { \
> spice_log(G_LOG_LEVEL_CRITICAL, SPICE_STRLOC, G_STRFUNC, "condition
> `%s' failed", #x); \
> + abort();
> \
> return; \
The 'return' statment is now unreachable code & can be removed - surprised
the compiler didn't complain that its unreachable.
> } \
> } G_STMT_END
> @@ -49,6 +51,7 @@ void spice_log(GLogLevelFlags log_level,
> #define spice_return_val_if_fail(x, val) G_STMT_START { \
> if G_LIKELY(x) { } else { \
> spice_log(G_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__,
> "condition `%s' failed", #x); \
> + abort();
> \
> return (val); \
Again here.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
_______________________________________________
Spice-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/spice-devel