|
From: | Konstantin Kostiuk |
Subject: | Re: [PATCH] qga-win: Free GMatchInfo properly |
Date: | Thu, 10 Jun 2021 18:59:12 +0300 |
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-expressions.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_FUNC(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 :|
[Prev in Thread] | Current Thread | [Next in Thread] |