mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
conf: domain: Remove virDomainObjParseNode
virDomainObjParseFile is the only caller of virDomainObjParseNode. The code can be merged into it, simplified by using virXMLParse and the function removed. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
1eb67d24de
commit
d4b6496f24
@ -19154,46 +19154,22 @@ virDomainDefParseNode(xmlDocPtr xml,
|
||||
}
|
||||
|
||||
|
||||
virDomainObj *
|
||||
virDomainObjParseNode(xmlDocPtr xml,
|
||||
xmlNodePtr root,
|
||||
virDomainXMLOption *xmlopt,
|
||||
unsigned int flags)
|
||||
{
|
||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||
|
||||
if (!virXMLNodeNameEqual(root, "domstatus")) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("unexpected root element <%s>, "
|
||||
"expecting <domstatus>"),
|
||||
root->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(ctxt = virXMLXPathContextNew(xml)))
|
||||
return NULL;
|
||||
|
||||
ctxt->node = root;
|
||||
return virDomainObjParseXML(ctxt, xmlopt, flags);
|
||||
}
|
||||
|
||||
|
||||
virDomainObj *
|
||||
virDomainObjParseFile(const char *filename,
|
||||
virDomainXMLOption *xmlopt,
|
||||
unsigned int flags)
|
||||
{
|
||||
g_autoptr(xmlDoc) xml = NULL;
|
||||
virDomainObj *obj = NULL;
|
||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||
int keepBlanksDefault = xmlKeepBlanksDefault(0);
|
||||
|
||||
if ((xml = virXMLParseFile(filename))) {
|
||||
obj = virDomainObjParseNode(xml, xmlDocGetRootElement(xml),
|
||||
xmlopt, flags);
|
||||
}
|
||||
|
||||
xml = virXMLParse(filename, NULL, NULL, "domstatus", &ctxt, NULL, false);
|
||||
xmlKeepBlanksDefault(keepBlanksDefault);
|
||||
return obj;
|
||||
|
||||
if (!xml)
|
||||
return NULL;
|
||||
|
||||
return virDomainObjParseXML(ctxt, xmlopt, flags);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3617,10 +3617,6 @@ virDomainDef *virDomainDefParseNode(xmlDocPtr doc,
|
||||
virDomainXMLOption *xmlopt,
|
||||
void *parseOpaque,
|
||||
unsigned int flags);
|
||||
virDomainObj *virDomainObjParseNode(xmlDocPtr xml,
|
||||
xmlNodePtr root,
|
||||
virDomainXMLOption *xmlopt,
|
||||
unsigned int flags);
|
||||
virDomainObj *virDomainObjParseFile(const char *filename,
|
||||
virDomainXMLOption *xmlopt,
|
||||
unsigned int flags);
|
||||
|
@ -582,7 +582,6 @@ virDomainObjIsFailedPostcopy;
|
||||
virDomainObjIsPostcopy;
|
||||
virDomainObjNew;
|
||||
virDomainObjParseFile;
|
||||
virDomainObjParseNode;
|
||||
virDomainObjRemoveTransientDef;
|
||||
virDomainObjSave;
|
||||
virDomainObjSetDefTransient;
|
||||
|
Loading…
x
Reference in New Issue
Block a user