mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
conf: Avoid checking root element name in virDomainDefParseNode
The only caller for which this check makes sense is virDomainDefParse. Thus the check should be moved there. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
9bcbc52ef1
commit
29307fa84d
@ -21520,12 +21520,21 @@ virDomainDefParse(const char *xmlStr,
|
||||
xmlDocPtr xml = NULL;
|
||||
virDomainDefPtr def = NULL;
|
||||
int keepBlanksDefault = xmlKeepBlanksDefault(0);
|
||||
xmlNodePtr root;
|
||||
|
||||
if (!(xml = virXMLParse(filename, xmlStr, _("(domain_definition)"))))
|
||||
goto cleanup;
|
||||
|
||||
def = virDomainDefParseNode(xml, xmlDocGetRootElement(xml), caps,
|
||||
xmlopt, parseOpaque, flags);
|
||||
root = xmlDocGetRootElement(xml);
|
||||
if (!virXMLNodeNameEqual(root, "domain")) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("unexpected root element <%s>, "
|
||||
"expecting <domain>"),
|
||||
root->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
def = virDomainDefParseNode(xml, root, caps, xmlopt, parseOpaque, flags);
|
||||
|
||||
cleanup:
|
||||
xmlFreeDoc(xml);
|
||||
@ -21566,14 +21575,6 @@ virDomainDefParseNode(xmlDocPtr xml,
|
||||
virDomainDefPtr def = NULL;
|
||||
virDomainDefPtr ret = NULL;
|
||||
|
||||
if (!virXMLNodeNameEqual(root, "domain")) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("unexpected root element <%s>, "
|
||||
"expecting <domain>"),
|
||||
root->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ctxt = xmlXPathNewContext(xml);
|
||||
if (ctxt == NULL) {
|
||||
virReportOOMError();
|
||||
|
Loading…
Reference in New Issue
Block a user