[libvirt] [PATCH 5/6] qemu: domain: Use virXMLFormatElement in qemuDomainObjPrivateXMLFormatJob
Peter Krempa
pkrempa at redhat.com
Fri Mar 2 16:53:32 UTC 2018
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 at 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180302/20133aef/attachment-0001.sig>
More information about the libvir-list
mailing list