Re: [GSoC] Design ideas for implementing cleanup attribute

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

 



On Fri, May 25, 2018 at 09:01:03AM +0200, Andrea Bolognani wrote:
> On Wed, 2018-05-23 at 18:23 +0200, Peter Krempa wrote:
> > On Wed, May 23, 2018 at 18:05:17 +0200, Pavel Hrdina wrote:
> [...]
> > > VIR_AUTOFREE char *str = NULL;
> > 
> > For consistency I'd prefer if the argument is in parentheses similarly
> > to the ones below.
> 
> Seconded.

Well that would mean having this macro:

    #define VIR_AUTOFREE(type) __attribute__((cleanup(virFree))) type *

and the usage would be:

    VIR_AUTOFREE(char) string = NULL;

Yes, for consistency it make sense but sometimes exception makes it look
better and IMHO this is the case so I would prefer

    #define VIR_AUTOFREE(type) __attribute__((cleanup(virFree)))

and

    VIR_AUTOFREE char *string = NULL;


The only sensible usage would be to have only VIR_AUTOPTR as you've
mentioned in other mail, but that would require a lot of typedefs.

Pavel

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