virInterfaceDefParse: Simplify and cleanup

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Tim Wiederhake 2022-01-12 13:41:39 +01:00
parent 56b4186efc
commit d8f6e198bf

View File

@ -704,14 +704,13 @@ virInterfaceDefParse(const char *xmlStr,
unsigned int flags)
{
g_autoptr(xmlDoc) xml = NULL;
virInterfaceDef *def = NULL;
if ((xml = virXMLParse(filename, xmlStr, _("(interface_definition)"), "interface.rng",
flags & VIR_INTERFACE_DEFINE_VALIDATE))) {
def = virInterfaceDefParseNode(xml, xmlDocGetRootElement(xml));
}
xml = virXMLParse(filename, xmlStr, _("(interface_definition)"),
"interface.rng", flags & VIR_INTERFACE_DEFINE_VALIDATE);
if (!xml)
return NULL;
return def;
return virInterfaceDefParseNode(xml, xmlDocGetRootElement(xml));
}