[PATCH 6/6] lib: Replace xmlKeepBlanksDefault() with virXMLParseWithIndent()

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

 



Now that we have virXMLParseWithIndent() and
virXMLParseStringCtxtWithIndent(), we can use them directly and
drop calls to xmlKeepBlanksDefault().

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/conf/backup_conf.c     |  8 +++-----
 src/conf/checkpoint_conf.c |  8 +++-----
 src/conf/domain_conf.c     | 11 +++--------
 src/conf/network_conf.c    |  6 ++----
 src/conf/snapshot_conf.c   |  8 +++-----
 tools/virsh-util.c         |  5 +----
 6 files changed, 15 insertions(+), 31 deletions(-)

diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c
index e151c29738..1fea6a2be7 100644
--- a/src/conf/backup_conf.c
+++ b/src/conf/backup_conf.c
@@ -276,13 +276,11 @@ virDomainBackupDefParseString(const char *xmlStr,
 {
     g_autoptr(xmlDoc) xml = NULL;
     g_autoptr(xmlXPathContext) ctxt = NULL;
-    int keepBlanksDefault = xmlKeepBlanksDefault(0);
     bool validate = !(flags & VIR_DOMAIN_BACKUP_PARSE_INTERNAL);
 
-    xml = virXMLParse(NULL, xmlStr, _("(domain_backup)"),
-                      "domainbackup", &ctxt, "domainbackup.rng", validate);
-
-    xmlKeepBlanksDefault(keepBlanksDefault);
+    xml = virXMLParseWithIndent(NULL, xmlStr, _("(domain_backup)"),
+                                "domainbackup", &ctxt, "domainbackup.rng",
+                                validate);
 
     if (!xml)
         return NULL;
diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c
index 89f8675235..3c797f0f5b 100644
--- a/src/conf/checkpoint_conf.c
+++ b/src/conf/checkpoint_conf.c
@@ -192,12 +192,10 @@ virDomainCheckpointDefParseString(const char *xmlStr,
 {
     g_autoptr(xmlDoc) xml = NULL;
     g_autoptr(xmlXPathContext) ctxt = NULL;
-    int keepBlanksDefault = xmlKeepBlanksDefault(0);
 
-    xml = virXMLParse(NULL, xmlStr, _("(domain_checkpoint)"),
-                      "domaincheckpoint", &ctxt, "domaincheckpoint.rng", true);
-
-    xmlKeepBlanksDefault(keepBlanksDefault);
+    xml = virXMLParseWithIndent(NULL, xmlStr, _("(domain_checkpoint)"),
+                                "domaincheckpoint", &ctxt,
+                                "domaincheckpoint.rng", true);
 
     if (!xml)
         return NULL;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bef76f46aa..428147fe44 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19503,13 +19503,10 @@ virDomainDefParse(const char *xmlStr,
 {
     g_autoptr(xmlDoc) xml = NULL;
     g_autoptr(xmlXPathContext) ctxt = NULL;
-    int keepBlanksDefault = xmlKeepBlanksDefault(0);
     bool validate = flags & VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA;
 
-    xml = virXMLParse(filename, xmlStr, _("(domain_definition)"),
-                      "domain", &ctxt, "domain.rng", validate);
-
-    xmlKeepBlanksDefault(keepBlanksDefault);
+    xml = virXMLParseWithIndent(filename, xmlStr, _("(domain_definition)"),
+                                "domain", &ctxt, "domain.rng", validate);
 
     if (!xml)
         return NULL;
@@ -19566,10 +19563,8 @@ virDomainObjParseFile(const char *filename,
 {
     g_autoptr(xmlDoc) xml = NULL;
     g_autoptr(xmlXPathContext) ctxt = NULL;
-    int keepBlanksDefault = xmlKeepBlanksDefault(0);
 
-    xml = virXMLParse(filename, NULL, NULL, "domstatus", &ctxt, NULL, false);
-    xmlKeepBlanksDefault(keepBlanksDefault);
+    xml = virXMLParseWithIndent(filename, NULL, NULL, "domstatus", &ctxt, NULL, false);
 
     if (!xml)
         return NULL;
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 1a6fd86180..0449b6f07c 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -1962,11 +1962,9 @@ virNetworkDefParse(const char *xmlStr,
 {
     g_autoptr(xmlDoc) xml = NULL;
     g_autoptr(xmlXPathContext) ctxt = NULL;
-    int keepBlanksDefault = xmlKeepBlanksDefault(0);
 
-    xml = virXMLParse(filename, xmlStr, _("(network_definition)"),
-                      "network", &ctxt, "network.rng", validate);
-    xmlKeepBlanksDefault(keepBlanksDefault);
+    xml = virXMLParseWithIndent(filename, xmlStr, _("(network_definition)"),
+                                "network", &ctxt, "network.rng", validate);
 
     if (!xml)
         return NULL;
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 4b0555eb8c..d7fcded302 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -426,13 +426,11 @@ virDomainSnapshotDefParseString(const char *xmlStr,
 {
     g_autoptr(xmlXPathContext) ctxt = NULL;
     g_autoptr(xmlDoc) xml = NULL;
-    int keepBlanksDefault = xmlKeepBlanksDefault(0);
     bool validate = flags & VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE;
 
-    xml = virXMLParse(NULL, xmlStr, _("(domain_snapshot)"),
-                      "domainsnapshot", &ctxt, "domainsnapshot.rng", validate);
-
-    xmlKeepBlanksDefault(keepBlanksDefault);
+    xml = virXMLParseWithIndent(NULL, xmlStr, _("(domain_snapshot)"),
+                                "domainsnapshot", &ctxt, "domainsnapshot.rng",
+                                validate);
 
     if (!xml)
         return NULL;
diff --git a/tools/virsh-util.c b/tools/virsh-util.c
index fb6327613a..a6026eed53 100644
--- a/tools/virsh-util.c
+++ b/tools/virsh-util.c
@@ -474,16 +474,13 @@ virshDumpXML(vshControl *ctl,
     g_autofree xmlNodePtr *nodes = NULL;
     int nnodes = 0;
     size_t i;
-    int oldblanks;
 
     if (xpath == NULL) {
         vshPrint(ctl, "%s", xml);
         return true;
     }
 
-    oldblanks = xmlKeepBlanksDefault(0);
-    doc = virXMLParseStringCtxt(xml, url, &ctxt);
-    xmlKeepBlanksDefault(oldblanks);
+    doc = virXMLParseStringCtxtWithIndent(xml, url, &ctxt);
     if (!doc)
         return false;
 
-- 
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