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?