On Thu, Mar 01, 2018 at 18:59:46 +0100, Peter Krempa wrote:
Modernize the code by using the clever formatter rather than
checking
manually when to format the end of the element.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_domain.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b7fb9f264d..e4088665ee 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2035,11 +2035,13 @@ qemuDomainObjPrivateXMLFormatAllowReboot(virBufferPtr buf,
}
-static void
+static int
qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf,
virDomainObjPtr vm,
qemuDomainObjPrivatePtr priv)
{
+ virBuffer attrBuf = VIR_BUFFER_INITIALIZER;
+ virBuffer childBuf = VIR_BUFFER_INITIALIZER;
qemuDomainJob job = priv->job.active;
if (!qemuDomainTrackJob(job))
@@ -2047,37 +2049,34 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf,
if (job == QEMU_JOB_NONE &&
priv->job.asyncJob == QEMU_ASYNC_JOB_NONE)
- return;
+ return 0;
+
+ virBufferSetChildIndent(&childBuf, buf);
- virBufferAsprintf(buf, "<job type='%s' async='%s'",
+ virBufferAsprintf(&attrBuf, "type='%s' async='%s'",
s/"type/" type/ here otherwise they'd be squashed together. It was found
by a test-suite improvement that I'll post shortly.