]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virInterfaceDefParseXML: Inline trivial virInterfaceDefParseName
authorTim Wiederhake <twiederh@redhat.com>
Wed, 12 Jan 2022 11:28:49 +0000 (12:28 +0100)
committerTim Wiederhake <twiederh@redhat.com>
Fri, 14 Jan 2022 14:38:49 +0000 (15:38 +0100)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/interface_conf.c

index 47f9da797deeb02531d1842b147adadaeee31355..91fe54e9a5ab953fe80b32477de5e01cb9302f16 100644 (file)
@@ -116,23 +116,6 @@ virInterfaceDefFree(virInterfaceDef *def)
 }
 
 
-static int
-virInterfaceDefParseName(virInterfaceDef *def,
-                         xmlXPathContextPtr ctxt)
-{
-    char *tmp;
-
-    tmp = virXPathString("string(./@name)", ctxt);
-    if (tmp == NULL) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       "%s",  _("interface has no name"));
-        return -1;
-    }
-    def->name = tmp;
-    return 0;
-}
-
-
 static int
 virInterfaceDefParseMtu(virInterfaceDef *def,
                         xmlXPathContextPtr ctxt)
@@ -662,8 +645,10 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt,
     }
     def->type = type;
 
-    if (virInterfaceDefParseName(def, ctxt) < 0)
-       return NULL;
+    if (!(def->name = virXMLPropString(ctxt->node, "name"))) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",  _("interface has no name"));
+        return NULL;
+    }
 
     if (parentIfType == VIR_INTERFACE_TYPE_LAST) {
         /* only recognize these in toplevel bond interfaces */