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