[libvirt] [GSoC] Design ideas for implementing cleanup attribute
Pavel Hrdina
phrdina at redhat.com
Fri May 25 08:08:43 UTC 2018
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
-------------- 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/777d15b2/attachment-0001.sig>
More information about the libvir-list
mailing list