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;
|
xmlDocPtr xml = NULL;
|
||||||
virDomainDefPtr def = NULL;
|
virDomainDefPtr def = NULL;
|
||||||
int keepBlanksDefault = xmlKeepBlanksDefault(0);
|
int keepBlanksDefault = xmlKeepBlanksDefault(0);
|
||||||
|
xmlNodePtr root;
|
||||||
|
|
||||||
if (!(xml = virXMLParse(filename, xmlStr, _("(domain_definition)"))))
|
if (!(xml = virXMLParse(filename, xmlStr, _("(domain_definition)"))))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
def = virDomainDefParseNode(xml, xmlDocGetRootElement(xml), caps,
|
root = xmlDocGetRootElement(xml);
|
||||||
xmlopt, parseOpaque, flags);
|
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:
|
cleanup:
|
||||||
xmlFreeDoc(xml);
|
xmlFreeDoc(xml);
|
||||||
@ -21566,14 +21575,6 @@ virDomainDefParseNode(xmlDocPtr xml,
|
|||||||
virDomainDefPtr def = NULL;
|
virDomainDefPtr def = NULL;
|
||||||
virDomainDefPtr ret = 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);
|
ctxt = xmlXPathNewContext(xml);
|
||||||
if (ctxt == NULL) {
|
if (ctxt == NULL) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
|
Loading…
Reference in New Issue
Block a user