[libvirt] [GSoC] Design ideas for implementing cleanup attribute

Pavel Hrdina phrdina at redhat.com
Fri May 25 08:46:24 UTC 2018


On Fri, May 25, 2018 at 10:32:04AM +0200, Andrea Bolognani wrote:
> 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?

Yes you can have that as well, but it doesn't look ugly to you? :)
If majority will agree on that I don't care, just my opinion.

Pavel
-------------- 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/20180525/f409bbed/attachment-0001.sig>


More information about the libvir-list mailing list