|
|
80a318 |
From 215a4afe93c051e35d09fabea19172ab51959737 Mon Sep 17 00:00:00 2001
|
|
|
80a318 |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
80a318 |
Date: Mon, 20 Nov 2023 16:20:51 +0100
|
|
|
80a318 |
Subject: [PATCH 7/7] lib: Replace xmlKeepBlanksDefault() with
|
|
|
80a318 |
virXMLParseWithIndent()
|
|
|
80a318 |
MIME-Version: 1.0
|
|
|
80a318 |
Content-Type: text/plain; charset=UTF-8
|
|
|
80a318 |
Content-Transfer-Encoding: 8bit
|
|
|
80a318 |
|
|
|
80a318 |
Now that we have virXMLParseWithIndent() and
|
|
|
80a318 |
virXMLParseStringCtxtWithIndent(), we can use them directly and
|
|
|
80a318 |
drop calls to xmlKeepBlanksDefault().
|
|
|
80a318 |
|
|
|
80a318 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
80a318 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
80a318 |
(cherry picked from commit 1fdca3083b52507d7a99f6e9b84e91d8df68013e)
|
|
|
80a318 |
---
|
|
|
80a318 |
src/conf/backup_conf.c | 8 +++-----
|
|
|
80a318 |
src/conf/checkpoint_conf.c | 8 +++-----
|
|
|
80a318 |
src/conf/domain_conf.c | 11 +++--------
|
|
|
80a318 |
src/conf/network_conf.c | 6 ++----
|
|
|
80a318 |
src/conf/snapshot_conf.c | 8 +++-----
|
|
|
80a318 |
tools/virsh-util.c | 5 +----
|
|
|
80a318 |
6 files changed, 15 insertions(+), 31 deletions(-)
|
|
|
80a318 |
|
|
|
80a318 |
diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c
|
|
|
80a318 |
index e151c29738..1fea6a2be7 100644
|
|
|
80a318 |
--- a/src/conf/backup_conf.c
|
|
|
80a318 |
+++ b/src/conf/backup_conf.c
|
|
|
80a318 |
@@ -276,13 +276,11 @@ virDomainBackupDefParseString(const char *xmlStr,
|
|
|
80a318 |
{
|
|
|
80a318 |
g_autoptr(xmlDoc) xml = NULL;
|
|
|
80a318 |
g_autoptr(xmlXPathContext) ctxt = NULL;
|
|
|
80a318 |
- int keepBlanksDefault = xmlKeepBlanksDefault(0);
|
|
|
80a318 |
bool validate = !(flags & VIR_DOMAIN_BACKUP_PARSE_INTERNAL);
|
|
|
80a318 |
|
|
|
80a318 |
- xml = virXMLParse(NULL, xmlStr, _("(domain_backup)"),
|
|
|
80a318 |
- "domainbackup", &ctxt, "domainbackup.rng", validate);
|
|
|
80a318 |
-
|
|
|
80a318 |
- xmlKeepBlanksDefault(keepBlanksDefault);
|
|
|
80a318 |
+ xml = virXMLParseWithIndent(NULL, xmlStr, _("(domain_backup)"),
|
|
|
80a318 |
+ "domainbackup", &ctxt, "domainbackup.rng",
|
|
|
80a318 |
+ validate);
|
|
|
80a318 |
|
|
|
80a318 |
if (!xml)
|
|
|
80a318 |
return NULL;
|
|
|
80a318 |
diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c
|
|
|
80a318 |
index 89f8675235..3c797f0f5b 100644
|
|
|
80a318 |
--- a/src/conf/checkpoint_conf.c
|
|
|
80a318 |
+++ b/src/conf/checkpoint_conf.c
|
|
|
80a318 |
@@ -192,12 +192,10 @@ virDomainCheckpointDefParseString(const char *xmlStr,
|
|
|
80a318 |
{
|
|
|
80a318 |
g_autoptr(xmlDoc) xml = NULL;
|
|
|
80a318 |
g_autoptr(xmlXPathContext) ctxt = NULL;
|
|
|
80a318 |
- int keepBlanksDefault = xmlKeepBlanksDefault(0);
|
|
|
80a318 |
|
|
|
80a318 |
- xml = virXMLParse(NULL, xmlStr, _("(domain_checkpoint)"),
|
|
|
80a318 |
- "domaincheckpoint", &ctxt, "domaincheckpoint.rng", true);
|
|
|
80a318 |
-
|
|
|
80a318 |
- xmlKeepBlanksDefault(keepBlanksDefault);
|
|
|
80a318 |
+ xml = virXMLParseWithIndent(NULL, xmlStr, _("(domain_checkpoint)"),
|
|
|
80a318 |
+ "domaincheckpoint", &ctxt,
|
|
|
80a318 |
+ "domaincheckpoint.rng", true);
|
|
|
80a318 |
|
|
|
80a318 |
if (!xml)
|
|
|
80a318 |
return NULL;
|
|
|
80a318 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
80a318 |
index 80f467ae7a..2b6f765b6d 100644
|
|
|
80a318 |
--- a/src/conf/domain_conf.c
|
|
|
80a318 |
+++ b/src/conf/domain_conf.c
|
|
|
80a318 |
@@ -19503,13 +19503,10 @@ virDomainDefParse(const char *xmlStr,
|
|
|
80a318 |
{
|
|
|
80a318 |
g_autoptr(xmlDoc) xml = NULL;
|
|
|
80a318 |
g_autoptr(xmlXPathContext) ctxt = NULL;
|
|
|
80a318 |
- int keepBlanksDefault = xmlKeepBlanksDefault(0);
|
|
|
80a318 |
bool validate = flags & VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA;
|
|
|
80a318 |
|
|
|
80a318 |
- xml = virXMLParse(filename, xmlStr, _("(domain_definition)"),
|
|
|
80a318 |
- "domain", &ctxt, "domain.rng", validate);
|
|
|
80a318 |
-
|
|
|
80a318 |
- xmlKeepBlanksDefault(keepBlanksDefault);
|
|
|
80a318 |
+ xml = virXMLParseWithIndent(filename, xmlStr, _("(domain_definition)"),
|
|
|
80a318 |
+ "domain", &ctxt, "domain.rng", validate);
|
|
|
80a318 |
|
|
|
80a318 |
if (!xml)
|
|
|
80a318 |
return NULL;
|
|
|
80a318 |
@@ -19566,10 +19563,8 @@ virDomainObjParseFile(const char *filename,
|
|
|
80a318 |
{
|
|
|
80a318 |
g_autoptr(xmlDoc) xml = NULL;
|
|
|
80a318 |
g_autoptr(xmlXPathContext) ctxt = NULL;
|
|
|
80a318 |
- int keepBlanksDefault = xmlKeepBlanksDefault(0);
|
|
|
80a318 |
|
|
|
80a318 |
- xml = virXMLParse(filename, NULL, NULL, "domstatus", &ctxt, NULL, false);
|
|
|
80a318 |
- xmlKeepBlanksDefault(keepBlanksDefault);
|
|
|
80a318 |
+ xml = virXMLParseWithIndent(filename, NULL, NULL, "domstatus", &ctxt, NULL, false);
|
|
|
80a318 |
|
|
|
80a318 |
if (!xml)
|
|
|
80a318 |
return NULL;
|
|
|
80a318 |
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
|
|
|
80a318 |
index 1a6fd86180..0449b6f07c 100644
|
|
|
80a318 |
--- a/src/conf/network_conf.c
|
|
|
80a318 |
+++ b/src/conf/network_conf.c
|
|
|
80a318 |
@@ -1962,11 +1962,9 @@ virNetworkDefParse(const char *xmlStr,
|
|
|
80a318 |
{
|
|
|
80a318 |
g_autoptr(xmlDoc) xml = NULL;
|
|
|
80a318 |
g_autoptr(xmlXPathContext) ctxt = NULL;
|
|
|
80a318 |
- int keepBlanksDefault = xmlKeepBlanksDefault(0);
|
|
|
80a318 |
|
|
|
80a318 |
- xml = virXMLParse(filename, xmlStr, _("(network_definition)"),
|
|
|
80a318 |
- "network", &ctxt, "network.rng", validate);
|
|
|
80a318 |
- xmlKeepBlanksDefault(keepBlanksDefault);
|
|
|
80a318 |
+ xml = virXMLParseWithIndent(filename, xmlStr, _("(network_definition)"),
|
|
|
80a318 |
+ "network", &ctxt, "network.rng", validate);
|
|
|
80a318 |
|
|
|
80a318 |
if (!xml)
|
|
|
80a318 |
return NULL;
|
|
|
80a318 |
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
|
|
|
80a318 |
index 4b0555eb8c..d7fcded302 100644
|
|
|
80a318 |
--- a/src/conf/snapshot_conf.c
|
|
|
80a318 |
+++ b/src/conf/snapshot_conf.c
|
|
|
80a318 |
@@ -426,13 +426,11 @@ virDomainSnapshotDefParseString(const char *xmlStr,
|
|
|
80a318 |
{
|
|
|
80a318 |
g_autoptr(xmlXPathContext) ctxt = NULL;
|
|
|
80a318 |
g_autoptr(xmlDoc) xml = NULL;
|
|
|
80a318 |
- int keepBlanksDefault = xmlKeepBlanksDefault(0);
|
|
|
80a318 |
bool validate = flags & VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE;
|
|
|
80a318 |
|
|
|
80a318 |
- xml = virXMLParse(NULL, xmlStr, _("(domain_snapshot)"),
|
|
|
80a318 |
- "domainsnapshot", &ctxt, "domainsnapshot.rng", validate);
|
|
|
80a318 |
-
|
|
|
80a318 |
- xmlKeepBlanksDefault(keepBlanksDefault);
|
|
|
80a318 |
+ xml = virXMLParseWithIndent(NULL, xmlStr, _("(domain_snapshot)"),
|
|
|
80a318 |
+ "domainsnapshot", &ctxt, "domainsnapshot.rng",
|
|
|
80a318 |
+ validate);
|
|
|
80a318 |
|
|
|
80a318 |
if (!xml)
|
|
|
80a318 |
return NULL;
|
|
|
80a318 |
diff --git a/tools/virsh-util.c b/tools/virsh-util.c
|
|
|
80a318 |
index fb6327613a..a6026eed53 100644
|
|
|
80a318 |
--- a/tools/virsh-util.c
|
|
|
80a318 |
+++ b/tools/virsh-util.c
|
|
|
80a318 |
@@ -474,16 +474,13 @@ virshDumpXML(vshControl *ctl,
|
|
|
80a318 |
g_autofree xmlNodePtr *nodes = NULL;
|
|
|
80a318 |
int nnodes = 0;
|
|
|
80a318 |
size_t i;
|
|
|
80a318 |
- int oldblanks;
|
|
|
80a318 |
|
|
|
80a318 |
if (xpath == NULL) {
|
|
|
80a318 |
vshPrint(ctl, "%s", xml);
|
|
|
80a318 |
return true;
|
|
|
80a318 |
}
|
|
|
80a318 |
|
|
|
80a318 |
- oldblanks = xmlKeepBlanksDefault(0);
|
|
|
80a318 |
- doc = virXMLParseStringCtxt(xml, url, &ctxt);
|
|
|
80a318 |
- xmlKeepBlanksDefault(oldblanks);
|
|
|
80a318 |
+ doc = virXMLParseStringCtxtWithIndent(xml, url, &ctxt);
|
|
|
80a318 |
if (!doc)
|
|
|
80a318 |
return false;
|
|
|
80a318 |
|
|
|
80a318 |
--
|
|
|
80a318 |
2.43.0
|
|
|
80a318 |
|