[libvirt PATCH 03/10] virNWFilterParseParamAttributes: Iterate over "element" children

Tim Wiederhake twiederh at redhat.com
Wed Jul 14 09:44:50 UTC 2021


"xmlNextElementSibling()" skips attribute nodes, making the explicit
check for the type of `cur` redundant. This prepares for the removal
of this check in the next commit.

Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/conf/nwfilter_params.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index c94e9679f8..3754cec55f 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -703,7 +703,7 @@ virNWFilterParseParamAttributes(xmlNodePtr cur)
 
     GHashTable *table = virHashNew(virNWFilterVarValueHashFree);
 
-    cur = cur->children;
+    cur = xmlFirstElementChild(cur);
 
     while (cur != NULL) {
         if (cur->type == XML_ELEMENT_NODE) {
@@ -739,7 +739,7 @@ virNWFilterParseParamAttributes(xmlNodePtr cur)
                 VIR_FREE(val);
             }
         }
-        cur = cur->next;
+        cur = xmlNextElementSibling(cur);
     }
     return table;
 
-- 
2.31.1




More information about the libvir-list mailing list