[libvirt] [GSoC] Design ideas for implementing cleanup attribute
Peter Krempa
pkrempa at redhat.com
Wed May 23 16:23:01 UTC 2018
On Wed, May 23, 2018 at 18:05:17 +0200, Pavel Hrdina wrote:
[...]
> I liked the way how GLib is solving the issue so we can simply use the
> same approach since it looks reasonable.
>
> There would be three different macros that would be used to annotate
> variable with attribute cleanup:
>
> VIR_AUTOFREE char *str = NULL;
For consistency I'd prefer if the argument is in parentheses similarly
to the ones below.
>
> - this would call virFree on that variable
>
> VIR_AUTOPTR(virDomain) domain = NULL;
>
> - this would call registered free function on that variable
> - to register the free function you would use:
>
> VIR_DEFINE_AUTOPTR_FUNC(virDomain, virDomainFree);
Did you mean virDomainPtr?
How is the type matched? Does it have to be a typedef'd type to use
this?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180523/b3520e30/attachment-0001.sig>
More information about the libvir-list
mailing list