[libvirt PATCH 3/3] virNWFilterParseParamAttributes: Simplify loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/nwfilter_params.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index 35ea0256c3..ca7b62874c 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -700,9 +700,8 @@ virNWFilterParseParamAttributes(xmlNodePtr cur)
 {
     g_autoptr(GHashTable) table = virHashNew(virNWFilterVarValueHashFree);
 
-    cur = xmlFirstElementChild(cur);
-
-    while (cur != NULL) {
+    for (cur = xmlFirstElementChild(cur); cur != NULL;
+         cur = xmlNextElementSibling(cur)) {
         if (virXMLNodeNameEqual(cur, "parameter")) {
             g_autofree char *nam = virXMLPropString(cur, "name");
             g_autofree char *val = virXMLPropString(cur, "value");
@@ -710,7 +709,6 @@ virNWFilterParseParamAttributes(xmlNodePtr cur)
 
             if (nam == NULL || !isValidVarName(nam) ||
                 val == NULL || !isValidVarValue(val)) {
-                cur = xmlNextElementSibling(cur);
                 continue;
             }
 
@@ -725,7 +723,6 @@ virNWFilterParseParamAttributes(xmlNodePtr cur)
             }
             value = NULL;
         }
-        cur = xmlNextElementSibling(cur);
     }
 
     return g_steal_pointer(&table);
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux