From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB0E0C433EF for ; Wed, 8 Dec 2021 09:13:26 +0000 (UTC) Received: from localhost ([::1]:44154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mut0v-0004Y8-Aq for qemu-devel@archiver.kernel.org; Wed, 08 Dec 2021 04:13:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muszI-0003l7-3w for qemu-devel@nongnu.org; Wed, 08 Dec 2021 04:11:44 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:57661) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muszC-0005IZ-9o for qemu-devel@nongnu.org; Wed, 08 Dec 2021 04:11:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638954697; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=TDztLCqzDHd+1E5B+PK8XGvcl5VOGWawySkzn/QRMVE=; b=NJZvYgX9lu9etX7JLmZoPi5h0AvOmD9TmSi4efDGvrPx5/bat7Y6E6bE5Gh/oulfqWDxVa ojl2g4Fm0FVLBehzr9+0Rb1aNTnFP/OGTw1DJc221hiiLgtZTPGvn3oEd4FfuCbmfhgcYc LZUOHYQ89gH+FzN4mVDwVPamLtn005g= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-45-UqgurkWyNR6BJTYy6NbUgA-1; Wed, 08 Dec 2021 04:11:30 -0500 X-MC-Unique: UqgurkWyNR6BJTYy6NbUgA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 464102F24; Wed, 8 Dec 2021 09:11:29 +0000 (UTC) Received: from redhat.com (unknown [10.39.194.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B956F5C22B; Wed, 8 Dec 2021 09:11:07 +0000 (UTC) Date: Wed, 8 Dec 2021 09:11:05 +0000 From: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= To: John Snow Subject: Re: [PATCH v2 2/2] ui/clipboard: Don't use g_autoptr just to free a variable Message-ID: References: <20211207204038.664133-1-jsnow@redhat.com> <20211207204038.664133-3-jsnow@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211207204038.664133-3-jsnow@redhat.com> User-Agent: Mutt/2.1.3 (2021-09-10) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=berrange@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.619, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 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: , Reply-To: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= Cc: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Philippe Mathieu Daude , Alex =?utf-8?Q?Benn=C3=A9e?= , qemu-devel@nongnu.org, Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Tue, Dec 07, 2021 at 03:40:38PM -0500, John Snow wrote: > Clang doesn't recognize that the variable is being "used" and will emit > a warning: > > ../ui/clipboard.c:47:34: error: variable 'old' set but not used [-Werror,-Wunused-but-set-variable] > g_autoptr(QemuClipboardInfo) old = NULL; > ^ > 1 error generated. > > OK, fine. Just do things the old way. > > Signed-off-by: John Snow > --- > ui/clipboard.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/ui/clipboard.c b/ui/clipboard.c > index d7b008d62a..9ab65efefb 100644 > --- a/ui/clipboard.c > +++ b/ui/clipboard.c > @@ -44,12 +44,11 @@ void qemu_clipboard_peer_release(QemuClipboardPeer *peer, > > void qemu_clipboard_update(QemuClipboardInfo *info) > { > - g_autoptr(QemuClipboardInfo) old = NULL; > assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT); > > notifier_list_notify(&clipboard_notifiers, info); > > - old = cbinfo[info->selection]; > + g_free(cbinfo[info->selection]); This is a ref counted data type - it can't use g_free: https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg04890.html > cbinfo[info->selection] = qemu_clipboard_info_ref(info); > } Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|