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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A073C47094 for ; Thu, 10 Jun 2021 16:02:00 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 802E760FEA for ; Thu, 10 Jun 2021 16:01:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 802E760FEA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrN82-0002tO-4d for qemu-devel@archiver.kernel.org; Thu, 10 Jun 2021 12:01:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrN5c-0000WT-7o for qemu-devel@nongnu.org; Thu, 10 Jun 2021 11:59:29 -0400 Received: from mail-yb1-xb2c.google.com ([2607:f8b0:4864:20::b2c]:46824) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lrN5Y-0004Q8-7M for qemu-devel@nongnu.org; Thu, 10 Jun 2021 11:59:27 -0400 Received: by mail-yb1-xb2c.google.com with SMTP id h15so11676807ybm.13 for ; Thu, 10 Jun 2021 08:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fq0rk/oKuglsSSZoTA1CLXyHRH8LUFqhk0NVPD1/GIk=; b=AdbxEYCwX3brdxWK9sXuA+W+mrqIk4YHP22pXVrUFummdQBPM1gV+eF2to7XvvNM26 smQN9FFg5/SabPSnGvJogr+UN3Ymh3u4ZsIoD4Z10LF9U19Zcs/GJknCgYDEoARW+T80 lEQd22zkvbLgTPRNs7nb8K00hVNfJs4CItMa/GArkCR0j/JvDb5Q0t+V3/ZfKiOeZ9TD Mqjdz4nLIppve6WDuzW2jScFipGBib1CvvE90yEPficlVvQQwsrnWe9nWhh5wHUMb6wH CfCPCzQg9J2o+f1A6BGAx2g9bGuDNHCYYH75WzNSQnlnw3fwukDBU0PsrrbzmgevS3J7 r8zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fq0rk/oKuglsSSZoTA1CLXyHRH8LUFqhk0NVPD1/GIk=; b=tf9ixpca6yk7WSS6Yps0VD9J1RbxDl23fegkmKdsHqjrlguD9r43i9XcPlRCaywO/q /CrlcPs8D61xz1IL5F2779UuOYIV0IA3eIZ8ScqS4mGGAyCmem/z0FodWEmOjOLAvy7y 7fxHiDId1qELYyLpLaHhy6CjEQq5IeAn2fu7DI129Qq2MOB+4e5TTGzqGfXFx33662Ym GFxrULjR5kjauOlSuokeQNh90wRQiw/P5qO+B4S6M0ha/1ZwJufoZZ8ef0W1ZxzJasLu cyaY1RxuzclhgHkwvmAPiGQbgpFZIl6W2pRQJBjDJkL5p+/aJax+qO3DyxlLpNJEeQiX qPIQ== X-Gm-Message-State: AOAM531aEde7toUtAXviMEe7TzHwVJ+jU+zcGuPhzyzeR261UHOfqa6b aBDOvGtRrLNkXZs9or8cZqFRp2YMY/ayLyXkJBsc6g== X-Google-Smtp-Source: ABdhPJwFgqZZZAdUJPNMO3UNxopzqVUZmC5tZjjDX2Rrg+s2sjNQBAOkEzNPFLNicOwdKzflI2rmWo1OYDRvA7NyOgg= X-Received: by 2002:a25:b53:: with SMTP id 80mr5112999ybl.379.1623340763283; Thu, 10 Jun 2021 08:59:23 -0700 (PDT) MIME-Version: 1.0 References: <20210610143800.3293854-1-konstantin@daynix.com> In-Reply-To: From: Konstantin Kostiuk Date: Thu, 10 Jun 2021 18:59:12 +0300 Message-ID: Subject: Re: [PATCH] qga-win: Free GMatchInfo properly To: =?UTF-8?Q?Daniel_P=2E_Berrang=C3=A9?= Content-Type: multipart/alternative; boundary="0000000000008b990005c46b7989" Received-SPF: none client-ip=2607:f8b0:4864:20::b2c; envelope-from=konstantin@daynix.com; helo=mail-yb1-xb2c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= , QEMU , Michael Roth Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --0000000000008b990005c46b7989 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks, Daniel! A new patch was sent. Best wishes, Kostiantyn Kostiuk On Thu, Jun 10, 2021 at 6:23 PM Daniel P. Berrang=C3=A9 wrote: > On Thu, Jun 10, 2021 at 05:53:35PM +0300, Konstantin Kostiuk wrote: > > Hi All, > > > > For freeing GMatchInfo struct, a special function is required. I'm not > sure is > > it possible to use g_autoptr in this case or no. > > In GLib example > > > https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expr= essions.html#g-regex-match > , > > g_match_info_free is used directly. > > That is fine - g_autoptr calls the required deallocation function > that was previously registered. This is different from g_autofree > which merely calls g_free. > > We can see GMatchInfo is configured to call g_match_info_free: > > $ grep GMatchIn /usr/include/glib-2.0/glib/*.h > /usr/include/glib-2.0/glib/glib-autocleanups.h:G_DEFINE_AUTOPTR_CLEANUP_F= UNC(GMatchInfo, > g_match_info_unref) > > > 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 :| > > --0000000000008b990005c46b7989 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks, Daniel!

A new patch was sen= t.

Best wishes,
Kostiantyn Kostiuk

On Thu, Jun 10, 2021 at 6:23 PM Daniel P. Berrang=C3=A9 <berrange@redhat.com> wrote:
On Thu, Jun 10, 2021 at = 05:53:35PM +0300, Konstantin Kostiuk wrote:
> Hi All,
>
> For freeing GMatchInfo struct, a special function is required. I'm= not sure is
> it possible to use g_autoptr in this case or no.
> In GLib example
> https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-ex= pressions.html#g-regex-match,
> g_match_info_free is used directly.

That is fine - g_autoptr calls the required deallocation function
that was previously registered. This is different from g_autofree
which merely calls g_free.

We can see GMatchInfo is configured to call g_match_info_free:

$ grep GMatchIn /usr/include/glib-2.0/glib/*.h
/usr/include/glib-2.0/glib/glib-autocleanups.h:G_DEFINE_AUTOPTR_CLEANUP_FUN= C(GMatchInfo, g_match_info_unref)


Regards,
Daniel
--
|: ht= tps://berrange.com=C2=A0 =C2=A0 =C2=A0 -o-=C2=A0 =C2=A0 h= ttps://www.flickr.com/photos/dberrange :|
|: htt= ps://libvirt.org=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-o-=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 https://fstop138.berrange.com :|
|: https://entangle-photo.org=C2=A0 =C2=A0 -o-=C2=A0 =C2=A0 = https://www.instagram.com/dberrange :|

--0000000000008b990005c46b7989--