[PATCH 2/7] virNetDevVPortProfileParse: Use virXMLNodeGetSubelement to find '<parameters>'

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

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/netdev_vport_profile_conf.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/conf/netdev_vport_profile_conf.c b/src/conf/netdev_vport_profile_conf.c
index cdde7efcd9..26f379248f 100644
--- a/src/conf/netdev_vport_profile_conf.c
+++ b/src/conf/netdev_vport_profile_conf.c
@@ -36,7 +36,7 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned int flags)
     g_autofree char *virtPortProfileID = NULL;
     g_autofree char *virtPortInterfaceID = NULL;
     g_autofree virNetDevVPortProfile *virtPort = NULL;
-    xmlNodePtr cur = node->children;
+    xmlNodePtr parameters;

     virtPort = g_new0(virNetDevVPortProfile, 1);

@@ -54,17 +54,13 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned int flags)
         return NULL;
     }

-    while (cur != NULL) {
-        if (virXMLNodeNameEqual(cur, "parameters")) {
-            virtPortManagerID = virXMLPropString(cur, "managerid");
-            virtPortTypeID = virXMLPropString(cur, "typeid");
-            virtPortTypeIDVersion = virXMLPropString(cur, "typeidversion");
-            virtPortInstanceID = virXMLPropString(cur, "instanceid");
-            virtPortProfileID = virXMLPropString(cur, "profileid");
-            virtPortInterfaceID = virXMLPropString(cur, "interfaceid");
-            break;
-        }
-        cur = cur->next;
+    if ((parameters = virXMLNodeGetSubelement(node, "parameters"))) {
+        virtPortManagerID = virXMLPropString(parameters, "managerid");
+        virtPortTypeID = virXMLPropString(parameters, "typeid");
+        virtPortTypeIDVersion = virXMLPropString(parameters, "typeidversion");
+        virtPortInstanceID = virXMLPropString(parameters, "instanceid");
+        virtPortProfileID = virXMLPropString(parameters, "profileid");
+        virtPortInterfaceID = virXMLPropString(parameters, "interfaceid");
     }

     if (virtPortManagerID) {
-- 
2.39.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