[libvirt PATCH 03/11] virxml: Simplify VIR_XPATH_NODE_AUTORESTORE

Ján Tomko jtomko at redhat.com
Wed Aug 25 14:54:21 UTC 2021


On a Wednesday in 2021, Tim Wiederhake wrote:
>Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
>---
> src/util/virxml.h | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
>diff --git a/src/util/virxml.h b/src/util/virxml.h
>index 06fb7aebd8..b4716630b9 100644
>--- a/src/util/virxml.h
>+++ b/src/util/virxml.h
>@@ -358,10 +358,8 @@ G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virXPathContextNodeSave, virXPathContextNodeRes
>  * node pointer is reset to the original value when this macro was used.
>  */
> #define VIR_XPATH_NODE_AUTORESTORE(_ctxt) \
>-    VIR_WARNINGS_NO_UNUSED_VARIABLE \
>-    g_auto(virXPathContextNodeSave) _ctxt ## CtxtSave = { .ctxt = _ctxt,\
>-                                                          .node = _ctxt->node}; \
>-    VIR_WARNINGS_RESET
>+    vir_g_auto(virXPathContextNodeSave) _ctxt ## CtxtSave = { .ctxt = _ctxt, \
>+                                                              .node = _ctxt->node}

Instead of creating the vir_g_auto macro, you can simply put the
G_GNUC_UNUSED in the declaration here:
g_auto(virXPathContextNodeSave) _ctxt ## CtxtSave G_GNUC_UNUSED = ...

(I don't remember why I did not figure that out in the first place.)

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210825/5ab4b4a9/attachment-0001.sig>


More information about the libvir-list mailing list