Re: [GSoC] Design ideas for implementing cleanup attribute

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

 



On Fri, 2018-05-25 at 10:08 +0200, Pavel Hrdina wrote:
> 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;

I'm probably missing something, but couldn't you just have

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

which you would then use as

    VIR_AUTOFREE(char *) string = NULL;

instead?

-- 
Andrea Bolognani / Red Hat / Virtualization

--
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