Re: [PATCH spice-common 1/3] log: Do not check impossible function return

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

 



For the series:
Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

On Wed, May 31, 2017 at 08:53:54AM +0100, Frediano Ziglio wrote:
> spice_log_level_to_glib never returns 0 so don't check
> for this value.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  common/log.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/common/log.c b/common/log.c
> index 28f518b..014b416 100644
> --- a/common/log.c
> +++ b/common/log.c
> @@ -104,14 +104,12 @@ static void spice_log_set_abort_level(void)
>              g_warning("Setting SPICE_ABORT_LEVEL is deprecated, use G_DEBUG instead");
>              abort_level = atoi(abort_str);
>              glib_abort_level = spice_log_level_to_glib(abort_level);
> -            if (glib_abort_level != 0) {
> -                unsigned int fatal_mask = G_LOG_FATAL_MASK;
> -                while (glib_abort_level >= G_LOG_LEVEL_ERROR) {
> -                    fatal_mask |= glib_abort_level;
> -                    glib_abort_level >>= 1;
> -                }
> -                g_log_set_fatal_mask(SPICE_LOG_DOMAIN, fatal_mask);
> +            unsigned int fatal_mask = G_LOG_FATAL_MASK;
> +            while (glib_abort_level >= G_LOG_LEVEL_ERROR) {
> +                fatal_mask |= glib_abort_level;
> +                glib_abort_level >>= 1;
>              }
> +            g_log_set_fatal_mask(SPICE_LOG_DOMAIN, fatal_mask);
>          } else {
>              abort_level = SPICE_ABORT_LEVEL_DEFAULT;
>          }
> @@ -157,8 +155,6 @@ static void spice_logv(const char *log_domain,
>  {
>      GString *log_msg;
>  
> -    g_return_if_fail(spice_log_level_to_glib(log_level) != 0);
> -
>      log_msg = g_string_new(NULL);
>      if (strloc && function) {
>          g_string_append_printf(log_msg, "%s:%s: ", strloc, function);
> -- 
> 2.9.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://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]