mirror of https://gitee.com/openkylin/libvirt.git
lib: Replace xmlKeepBlanksDefault() with virXMLParseWithIndent()
Now that we have virXMLParseWithIndent() and virXMLParseStringCtxtWithIndent(), we can use them directly and drop calls to xmlKeepBlanksDefault(). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
69958ba310
commit
1fdca3083b
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue