[PATCH 4/6] virXMLParseHelper: Store XML parsing flags in a variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux