diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2023-01-17 15:10:13 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2023-03-13 22:57:39 +0400 |
commit | 2512a026fab8d526e623426a3002599a2de09d16 (patch) | |
tree | 72a8c76fda4ee1cacf2a690a6f87139762fb702d /ui | |
parent | f4579e2899df552ea0c1e2f68447fd64b0c38836 (diff) | |
download | qemu-2512a026fab8d526e623426a3002599a2de09d16.zip qemu-2512a026fab8d526e623426a3002599a2de09d16.tar.gz qemu-2512a026fab8d526e623426a3002599a2de09d16.tar.bz2 |
ui: rename cursor_{get->ref}, return it
The naming is more conventional in QEMU code, and allows to simplify
some code by changing the API design, so it returns the input parameter,
instead of void.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/cursor.c | 3 | ||||
-rw-r--r-- | ui/dbus-listener.c | 3 | ||||
-rw-r--r-- | ui/spice-display.c | 4 | ||||
-rw-r--r-- | ui/vnc.c | 3 |
4 files changed, 6 insertions, 7 deletions
diff --git a/ui/cursor.c b/ui/cursor.c index 31b09bf..6fe6799 100644 --- a/ui/cursor.c +++ b/ui/cursor.c @@ -106,9 +106,10 @@ QEMUCursor *cursor_alloc(int width, int height) return c; } -void cursor_get(QEMUCursor *c) +QEMUCursor *cursor_ref(QEMUCursor *c) { c->refcount++; + return c; } void cursor_unref(QEMUCursor *c) diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 906ab29..2e87ed7 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -339,14 +339,13 @@ static void dbus_cursor_define(DisplayChangeListener *dcl, DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl); GVariant *v_data = NULL; - cursor_get(c); v_data = g_variant_new_from_data( G_VARIANT_TYPE("ay"), c->data, c->width * c->height * 4, TRUE, (GDestroyNotify)cursor_unref, - c); + cursor_ref(c)); qemu_dbus_display1_listener_call_cursor_define( ddl->proxy, diff --git a/ui/spice-display.c b/ui/spice-display.c index 243a794..5bee19a 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -460,7 +460,7 @@ void qemu_spice_cursor_refresh_bh(void *opaque) if (ssd->cursor) { QEMUCursor *c = ssd->cursor; assert(ssd->dcl.con); - cursor_get(c); + cursor_ref(c); qemu_mutex_unlock(&ssd->lock); dpy_cursor_define(ssd->dcl.con, c); qemu_mutex_lock(&ssd->lock); @@ -765,7 +765,7 @@ static void display_mouse_define(DisplayChangeListener *dcl, SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl); qemu_mutex_lock(&ssd->lock); - cursor_get(c); + cursor_ref(c); cursor_unref(ssd->cursor); ssd->cursor = c; ssd->hot_x = c->hot_x; @@ -1032,8 +1032,7 @@ static void vnc_dpy_cursor_define(DisplayChangeListener *dcl, cursor_unref(vd->cursor); g_free(vd->cursor_mask); - vd->cursor = c; - cursor_get(vd->cursor); + vd->cursor = cursor_ref(vd->cursor); vd->cursor_msize = cursor_get_mono_bpl(c) * c->height; vd->cursor_mask = g_malloc0(vd->cursor_msize); cursor_get_mono_mask(c, 0, vd->cursor_mask); |