The virXMLParseHelper() can work in two modes: either it parses a
file or a string. Either way, the same set of flags is specified
in call of corresponding function. Save flags in a local variable
instead.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/util/virxml.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 4f215a0e59..31685cddde 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -1136,6 +1136,8 @@ virXMLParseHelper(int domcode,
g_autoptr(xmlDoc) xml = NULL;
xmlNodePtr rootnode;
const char *docname;
+ const int parseFlags = XML_PARSE_NONET |
+ XML_PARSE_NOWARNING;
if (filename)
docname = filename;
@@ -1154,13 +1156,9 @@ virXMLParseHelper(int domcode,
pctxt->sax->error = catchXMLError;
if (filename) {
- xml = xmlCtxtReadFile(pctxt, filename, NULL,
- XML_PARSE_NONET |
- XML_PARSE_NOWARNING);
+ xml = xmlCtxtReadFile(pctxt, filename, NULL, parseFlags);
} else {
- xml = xmlCtxtReadDoc(pctxt, BAD_CAST xmlStr, url, NULL,
- XML_PARSE_NONET |
- XML_PARSE_NOWARNING);
+ xml = xmlCtxtReadDoc(pctxt, BAD_CAST xmlStr, url, NULL, parseFlags);
}
if (!xml) {
--
2.41.0