Re: [GSoC] Design ideas for implementing cleanup attribute

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux