mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
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>
This commit is contained in:
parent
4595a48a10
commit
ef1e1e0782
20 changed files with 39 additions and 93 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue