summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2015-08-26 12:17:18 +0100
committerMichael Tokarev <mjt@tls.msk.ru>2015-09-11 10:21:38 +0300
commitef1e1e0782e99c9dcf2b35e5310cdd8ca9211374 (patch)
tree0b0f9a746055b66019016ed2d8e4ff9df7d79a8c /ui
parent4595a48a10e576638795950b61957f83d2ed09b4 (diff)
downloadqemu-ef1e1e0782e99c9dcf2b35e5310cdd8ca9211374.zip
maint: avoid useless "if (foo) free(foo)" pattern
The free() and g_free() functions both happily accept NULL on any platform QEMU builds on. As such putting a conditional 'if (foo)' check before calls to 'free(foo)' merely serves to bloat the lines of code. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'ui')
-rw-r--r--ui/spice-display.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 0360abfd2c..77c8cbab88 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -737,9 +737,7 @@ static void display_mouse_set(DisplayChangeListener *dcl,
qemu_mutex_lock(&ssd->lock);
ssd->ptr_x = x;
ssd->ptr_y = y;
- if (ssd->ptr_move) {
- g_free(ssd->ptr_move);
- }
+ g_free(ssd->ptr_move);
ssd->ptr_move = qemu_spice_create_cursor_update(ssd, NULL, on);
qemu_mutex_unlock(&ssd->lock);
}
@@ -752,13 +750,9 @@ static void display_mouse_define(DisplayChangeListener *dcl,
qemu_mutex_lock(&ssd->lock);
ssd->hot_x = c->hot_x;
ssd->hot_y = c->hot_y;
- if (ssd->ptr_move) {
- g_free(ssd->ptr_move);
- ssd->ptr_move = NULL;
- }
- if (ssd->ptr_define) {
- g_free(ssd->ptr_define);
- }
+ g_free(ssd->ptr_move);
+ ssd->ptr_move = NULL;
+ g_free(ssd->ptr_define);
ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c, 0);
qemu_mutex_unlock(&ssd->lock);
}