Last indentation prior to <devices>.
* src/conf/domain_conf.c (virDomainTimerDefFormat)
(virDomainLifecycleDefFormat): Add parameter.
(virDomainDefFormatInternal): Adjust caller.
---
src/conf/domain_conf.c | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4b825fb..f6df921 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9043,6 +9043,7 @@ static int
virDomainLifecycleDefFormat(virBufferPtr buf,
int type,
const char *name,
+ int indent,
virLifecycleToStringFunc convFunc)
{
const char *typeStr = convFunc(type);
@@ -9052,7 +9053,8 @@ virDomainLifecycleDefFormat(virBufferPtr buf,
return -1;
}
- virBufferAsprintf(buf, " <%s>%s</%s>\n", name, typeStr,
name);
+ virBufferAsprintf(buf, "%*s<%s>%s</%s>\n",
+ indent, "", name, typeStr, name);
return 0;
}
@@ -10008,7 +10010,8 @@ virDomainInputDefFormat(virBufferPtr buf,
static int
virDomainTimerDefFormat(virBufferPtr buf,
- virDomainTimerDefPtr def)
+ virDomainTimerDefPtr def,
+ int indent)
{
const char *name = virDomainTimerNameTypeToString(def->name);
@@ -10017,7 +10020,7 @@ virDomainTimerDefFormat(virBufferPtr buf,
_("unexpected timer name %d"), def->name);
return -1;
}
- virBufferAsprintf(buf, " <timer name='%s'", name);
+ virBufferAsprintf(buf, "%*s<timer name='%s'", indent,
"", name);
if (def->present == 0) {
virBufferAddLit(buf, " present='no'");
@@ -10075,7 +10078,8 @@ virDomainTimerDefFormat(virBufferPtr buf,
&& (def->catchup.limit == 0)) {
virBufferAddLit(buf, "/>\n");
} else {
- virBufferAddLit(buf, ">\n <catchup ");
+ virBufferAddLit(buf, ">\n");
+ virBufferIndentAddLit(buf, indent + 2, "<catchup ");
if (def->catchup.threshold > 0) {
virBufferAsprintf(buf, " threshold='%lu'",
def->catchup.threshold);
}
@@ -10085,7 +10089,8 @@ virDomainTimerDefFormat(virBufferPtr buf,
if (def->catchup.limit > 0) {
virBufferAsprintf(buf, " limit='%lu'",
def->catchup.limit);
}
- virBufferAddLit(buf, "/>\n </timer>\n");
+ virBufferAddLit(buf, "/>\n");
+ virBufferIndentAddLit(buf, indent, "</timer>\n");
}
return 0;
@@ -10740,23 +10745,24 @@ virDomainDefFormatInternal(virDomainDefPtr def,
} else {
virBufferAddLit(buf, ">\n");
for (n = 0; n < def->clock.ntimers; n++) {
- if (virDomainTimerDefFormat(buf, def->clock.timers[n]) < 0) /* XXX
indent */
+ if (virDomainTimerDefFormat(buf, def->clock.timers[n],
+ indent + 2) < 0)
goto cleanup;
}
virBufferIndentAddLit(buf, indent, "</clock>\n");
}
if (virDomainLifecycleDefFormat(buf, def->onPoweroff,
- "on_poweroff",
- virDomainLifecycleTypeToString) < 0) /* XXX indent
*/
+ "on_poweroff", indent,
+ virDomainLifecycleTypeToString) < 0)
goto cleanup;
if (virDomainLifecycleDefFormat(buf, def->onReboot,
- "on_reboot",
- virDomainLifecycleTypeToString) < 0) /* XXX indent
*/
+ "on_reboot", indent,
+ virDomainLifecycleTypeToString) < 0)
goto cleanup;
if (virDomainLifecycleDefFormat(buf, def->onCrash,
- "on_crash",
- virDomainLifecycleCrashTypeToString) < 0) /* XXX
indent */
+ "on_crash", indent,
+ virDomainLifecycleCrashTypeToString) < 0)
goto cleanup;
virBufferIndentAddLit(buf, indent, "<devices>\n");
--
1.7.4.4