[Spice-devel] fixup! Allows reds_core_timer_remove to accept NULL for timer

Submitted by Pavel Grunt on Nov. 30, 2016, 5:19 p.m.

Details

Message ID 20161130171950.17284-1-pgrunt@redhat.com
State New
Headers show
Series "Start cleaning objects on destruction" ( rev: 4 ) in Spice

Not browsing as part of any series.

Commit Message

Pavel Grunt Nov. 30, 2016, 5:19 p.m.
---
to really be able to clean without any warnings it is needed to return as early as possible
---
 server/reds.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/reds.c b/server/reds.c
index 28127e8..8c86ece 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3608,9 +3608,7 @@  SPICE_GNUC_VISIBLE void spice_server_destroy(SpiceServer *reds)
     if (reds->main_channel) {
         red_channel_destroy(RED_CHANNEL(reds->main_channel));
     }
-    if (reds->mig_timer) {
-        reds_core_timer_remove(reds, reds->mig_timer);
-    }
+    reds_core_timer_remove(reds, reds->mig_timer);
 
     if (reds->main_dispatcher) {
         g_object_unref(reds->main_dispatcher);
@@ -4211,12 +4209,14 @@  void reds_core_timer_cancel(RedsState *reds,
 void reds_core_timer_remove(RedsState *reds,
                             SpiceTimer *timer)
 {
-   g_return_if_fail(reds != NULL);
-   g_return_if_fail(reds->core.timer_remove != NULL);
-
-    if (timer) {
-        reds->core.timer_remove(&reds->core, timer);
+    if (timer == NULL) {
+        return;
     }
+
+    g_return_if_fail(reds != NULL);
+    g_return_if_fail(reds->core.timer_remove != NULL);
+
+    reds->core.timer_remove(&reds->core, timer);
 }
 
 void reds_update_client_mouse_allowed(RedsState *reds)