On 2/27/19 3:27 AM, Peter Krempa wrote:
>> + * node pointer is reset to the original value when this
macro was used.
>> + */
>> +# define VIR_XPATH_NODE_AUTORESTORE(ctxt) \
>> + VIR_AUTOCLEAN(virXPathContextNodeSave) ctxt ## CtxtSave = {(ctxt),
(ctxt)->node}
>
> Worth using C99 syntax as in { .ctxt = (ctxt), .node = (ctxt)->node, } ?
It would require renaming the argument of the macro as it would be
replaced otherwise. Interrestingly in most cases it would actually work
as in most cases the macro is used with 'ctxt'.
And hence why it's a good idea to use macro parameter names which can't
conflict with normal cods, such as:
#define VIR_XPATH_NODE_AUTORESTORE(_ctxt) \
VIR_AUTOCLEAN(virXPathContextNodeSave) _ctxt##CtxtSave = { \
.ctxt = (_ctxt), .node = (_ctxt)->node, }
But I'll leave it up to you to decide whether it makes sense to worry
about C99 initializers.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization:
qemu.org |
libvirt.org