[PATCH 38/43] util: xml: Remove virXMLParseFile

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


Most callers prefer using the XPath context. Convert the last user to
use virXMLParseFileCtxt and remove the helper macro.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/util/virxml.h     | 11 -----------
 tests/virschematest.c |  2 +-
 2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/src/util/virxml.h b/src/util/virxml.h
index 72d45f8018..d773716a8c 100644
--- a/src/util/virxml.h
+++ b/src/util/virxml.h
@@ -216,17 +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)

-/**
- * virXMLParseFile:
- * @filename: file to parse
- *
- * Parse xml from a file.
- *
- * Return the parsed document object, or NULL on failure.
- */
-#define virXMLParseFile(filename) \
-    virXMLParseHelper(VIR_FROM_THIS, filename, NULL, NULL, NULL, NULL, NULL, false)
-
 /**
  * virXMLParseCtxt:
  * @filename: file to parse, or NULL for string parsing
diff --git a/tests/virschematest.c b/tests/virschematest.c
index dd13d82c62..cae502a338 100644
--- a/tests/virschematest.c
+++ b/tests/virschematest.c
@@ -51,7 +51,7 @@ testSchemaValidateXML(const void *args)
     bool shouldFail = virStringHasSuffix(data->xml_path, "-invalid.xml");
     g_autoptr(xmlDoc) xml = NULL;

-    if (!(xml = virXMLParseFile(data->xml_path)))
+    if (!(xml = virXMLParseFileCtxt(data->xml_path, NULL)))
         return -1;

     if ((virXMLValidatorValidate(data->validator, xml) < 0) != shouldFail)
-- 
2.37.3



More information about the libvir-list mailing list