From nobody Mon Feb 9 19:08:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1678705555; cv=none; d=zohomail.com; s=zohoarc; b=WECuFAS4VVBduXSEC9iwBFMHKnDFMth4wg5GKz16Dc+31Pjfk32LH9BJBOC6RBFnrOGOQQRbyRx+89lE7zxragEnjciL85CNpBtTA2T5zyXqy6Rpqwf+9HLNym9/flT0hEJuI8Q48LdA3jK2gl73LN3joVTNSsIjBXhJSpHYnPE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678705555; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DYo2xsJrv7p52Pp7Pfb/+4CcUL5ojeeADVJxY55Rqmk=; b=hhEN/b06GhrBCXULzn8k/nQDxbtcXPfU7VPm2EKow0CuFFm+FBSi+7jkFL2F6IWtVes75Bq1lzwitsDxPLJGYRjKeK1IU2ZylCF85K4lW1EW9idLDmxD74HqU+eQ8LeLhN05ZQrQ8lwCCZQuU9vdu44cH2G75OgkBnc5VbYwBaQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1678705555584631.8206155323; Mon, 13 Mar 2023 04:05:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbfwM-0002Sp-51; Mon, 13 Mar 2023 07:02:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbfwJ-0002L2-U1 for qemu-devel@nongnu.org; Mon, 13 Mar 2023 07:02:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbfwI-000406-6O for qemu-devel@nongnu.org; Mon, 13 Mar 2023 07:02:03 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-588-6ytWRqtqNjeTdRvqj4fDbQ-1; Mon, 13 Mar 2023 07:02:00 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 37C913814598; Mon, 13 Mar 2023 11:02:00 +0000 (UTC) Received: from localhost (unknown [10.39.208.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07D3240C83A9; Mon, 13 Mar 2023 11:01:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678705321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DYo2xsJrv7p52Pp7Pfb/+4CcUL5ojeeADVJxY55Rqmk=; b=N839nRlfWuPRPhj5ytivKh284DCCHEQIQd2dyKZRnDE+UWo5cbqQM/t8537IMAD3b7Kqgb hX/GIOo9u3OIVx524NzIthGWD4ag4IOinshycaw4M6cTurqOSmwKxkpUD0JYu6ptZ4cVBY RqiW9ynN3i+1RsaBUORGooKzRD0S77o= X-MC-Unique: 6ytWRqtqNjeTdRvqj4fDbQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , Laurent Vivier Subject: [PULL 07/18] ui: rename cursor_{get->ref}, return it Date: Mon, 13 Mar 2023 15:01:15 +0400 Message-Id: <20230313110126.383392-8-marcandre.lureau@redhat.com> In-Reply-To: <20230313110126.383392-1-marcandre.lureau@redhat.com> References: <20230313110126.383392-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1678705557210100003 From: Marc-Andr=C3=A9 Lureau 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=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- include/ui/console.h | 2 +- ui/cursor.c | 3 ++- ui/dbus-listener.c | 3 +-- ui/spice-display.c | 4 ++-- ui/vnc.c | 3 +-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 3efd1f6b82..0b01df947e 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -151,7 +151,7 @@ typedef struct QEMUCursor { } QEMUCursor; =20 QEMUCursor *cursor_alloc(int width, int height); -void cursor_get(QEMUCursor *c); +QEMUCursor *cursor_ref(QEMUCursor *c); void cursor_unref(QEMUCursor *c); QEMUCursor *cursor_builtin_hidden(void); QEMUCursor *cursor_builtin_left_ptr(void); diff --git a/ui/cursor.c b/ui/cursor.c index 31b09bf058..6fe67990e2 100644 --- a/ui/cursor.c +++ b/ui/cursor.c @@ -106,9 +106,10 @@ QEMUCursor *cursor_alloc(int width, int height) return c; } =20 -void cursor_get(QEMUCursor *c) +QEMUCursor *cursor_ref(QEMUCursor *c) { c->refcount++; + return c; } =20 void cursor_unref(QEMUCursor *c) diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 906ab296ca..2e87ed7e9a 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -339,14 +339,13 @@ static void dbus_cursor_define(DisplayChangeListener = *dcl, DBusDisplayListener *ddl =3D container_of(dcl, DBusDisplayListener, dc= l); GVariant *v_data =3D NULL; =20 - cursor_get(c); v_data =3D g_variant_new_from_data( G_VARIANT_TYPE("ay"), c->data, c->width * c->height * 4, TRUE, (GDestroyNotify)cursor_unref, - c); + cursor_ref(c)); =20 qemu_dbus_display1_listener_call_cursor_define( ddl->proxy, diff --git a/ui/spice-display.c b/ui/spice-display.c index 243a794638..5bee19a7f9 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 =3D 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 =3D container_of(dcl, SimpleSpiceDisplay, dcl); =20 qemu_mutex_lock(&ssd->lock); - cursor_get(c); + cursor_ref(c); cursor_unref(ssd->cursor); ssd->cursor =3D c; ssd->hot_x =3D c->hot_x; diff --git a/ui/vnc.c b/ui/vnc.c index 0bdcc3dfce..8aec5d751e 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1032,8 +1032,7 @@ static void vnc_dpy_cursor_define(DisplayChangeListen= er *dcl, cursor_unref(vd->cursor); g_free(vd->cursor_mask); =20 - vd->cursor =3D c; - cursor_get(vd->cursor); + vd->cursor =3D cursor_ref(vd->cursor); vd->cursor_msize =3D cursor_get_mono_bpl(c) * c->height; vd->cursor_mask =3D g_malloc0(vd->cursor_msize); cursor_get_mono_mask(c, 0, vd->cursor_mask); --=20 2.39.2