util: xml: Remove virXMLParseStringCtxtRoot

Remove the seldom used helper in favor of full virXMLParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-09-23 15:38:49 +02:00
parent e95f681305
commit a31d427123
3 changed files with 6 additions and 10 deletions

View File

@ -13655,7 +13655,8 @@ virDomainDiskDefParse(const char *xmlStr,
g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
if (!(xml = virXMLParseStringCtxtRoot(xmlStr, _("(disk_definition)"), "disk", &ctxt)))
if (!(xml = virXMLParse(NULL, xmlStr, _("(disk_definition)"),
"disk", &ctxt, NULL, false)))
return NULL;
return virDomainDiskDefParseXML(xmlopt, ctxt->node, ctxt, flags);
@ -13672,7 +13673,8 @@ virDomainDiskDefParseSource(const char *xmlStr,
g_autoptr(virStorageSource) src = NULL;
xmlNodePtr driverNode;
if (!(xml = virXMLParseStringCtxtRoot(xmlStr, _("(disk_definition)"), "disk", &ctxt)))
if (!(xml = virXMLParse(NULL, xmlStr, _("(disk_definition)"),
"disk", &ctxt, NULL, false)))
return NULL;
if (!(src = virDomainDiskDefParseSourceXML(xmlopt, ctxt->node, ctxt, flags)))

View File

@ -667,10 +667,8 @@ virStoragePoolDefParseSourceString(const char *srcSpec,
g_autoptr(xmlXPathContext) xpath_ctxt = NULL;
g_autoptr(virStoragePoolSource) def = NULL;
if (!(doc = virXMLParseStringCtxtRoot(srcSpec,
_("(storage_source_specification)"),
"source",
&xpath_ctxt)))
if (!(doc = virXMLParse(NULL, srcSpec, _("(storage_source_specification)"),
"source", &xpath_ctxt, NULL, false)))
return NULL;
def = g_new0(virStoragePoolSource, 1);

View File

@ -230,10 +230,6 @@ virXMLPickShellSafeComment(const char *str1,
#define virXMLParseStringCtxt(xmlStr, url, pctxt) \
virXMLParseHelper(VIR_FROM_THIS, NULL, xmlStr, url, NULL, pctxt, NULL, false)
/* virXMLParseStringCtxtRoot is same as above, except it also validates root node name */
#define virXMLParseStringCtxtRoot(xmlStr, url, rootnode, pctxt) \
virXMLParseHelper(VIR_FROM_THIS, NULL, xmlStr, url, rootnode, pctxt, NULL, false)
/**
* virXMLParseFileCtxt:
* @filename: file to parse