[Spice-devel] [PATCH spice-common 1/3] log: Do not check impossible function return
Christophe Fergeau
cfergeau at redhat.com
Wed May 31 08:29:06 UTC 2017
For the series:
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
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 at redhat.com>
> ---
> 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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170531/cab7ab4a/attachment.sig>
More information about the Spice-devel
mailing list