[Spice-devel] [PATCH spice-common 1/3] log: Do not check impossible function return
Frediano Ziglio
fziglio at redhat.com
Wed May 31 07:53:54 UTC 2017
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
More information about the Spice-devel
mailing list