[PATCH 39/43] util: xml: Remove virXMLParseCtxt

Peter Krempa pkrempa at redhat.com
Tue Oct 4 08:33:13 UTC 2022


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

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/conf/virnetworkobj.c |  2 +-
 src/conf/virstorageobj.c |  2 +-
 src/util/virxml.h        | 15 ---------------
 3 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index d23eb2f401..635d2ec0b0 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -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))) {
diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index 77128a4846..98d9e0b97e 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -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))) {
diff --git a/src/util/virxml.h b/src/util/virxml.h
index d773716a8c..9ec4920807 100644
--- a/src/util/virxml.h
+++ b/src/util/virxml.h
@@ -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
-- 
2.37.3



More information about the libvir-list mailing list