[Spice-devel] [PATCH spice] fixup! Allows reds_core_timer_remove to accept NULL for timer
Pavel Grunt
pgrunt at redhat.com
Wed Nov 30 17:19:50 UTC 2016
---
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(-)
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)
--
2.10.2
More information about the Spice-devel
mailing list