util: xml: Remove virXMLParseCtxt

Convert the two outstanding uses to virXMLParseFileCtxt as they always
pass a filename and remove the helper macro.

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 14:53:21 +02:00
parent 30095f4f4c
commit afa2970b7f
3 changed files with 2 additions and 17 deletions

View File

@ -858,7 +858,7 @@ virNetworkLoadState(virNetworkObjList *nets,
if ((configFile = virNetworkConfigFile(stateDir, name)) == NULL)
return NULL;
if (!(xml = virXMLParseCtxt(configFile, NULL, _("(network status)"), &ctxt)))
if (!(xml = virXMLParseFileCtxt(configFile, &ctxt)))
return NULL;
if (!(node = virXPathNode("//network", ctxt))) {

View File

@ -1622,7 +1622,7 @@ virStoragePoolObjLoadState(virStoragePoolObjList *pools,
VIR_DEBUG("loading storage pool state XML '%s'", stateFile);
if (!(xml = virXMLParseCtxt(stateFile, NULL, _("(pool state)"), &ctxt)))
if (!(xml = virXMLParseFileCtxt(stateFile, &ctxt)))
return NULL;
if (!(node = virXPathNode("//pool", ctxt))) {

View File

@ -216,21 +216,6 @@ virXMLPickShellSafeComment(const char *str1,
#define virXMLParse(filename, xmlStr, url, rootelement, ctxt, schemafile, validate) \
virXMLParseHelper(VIR_FROM_THIS, filename, xmlStr, url, rootelement, ctxt, schemafile, validate)
/**
* virXMLParseCtxt:
* @filename: file to parse, or NULL for string parsing
* @xmlStr: if @filename is NULL, a string to parse
* @url: if @filename is NULL, an optional filename to attribute the parse to
* @pctxt: if non-NULL, populate with a new context object on success,
* with (*pctxt)->node pre-set to the root node
*
* Parse xml from either a file or a string.
*
* Return the parsed document object, or NULL on failure.
*/
#define virXMLParseCtxt(filename, xmlStr, url, pctxt) \
virXMLParseHelper(VIR_FROM_THIS, filename, xmlStr, url, NULL, pctxt, NULL, false)
/**
* virXMLParseStringCtxt:
* @xmlStr: a string to parse