[libvirt] [PATCH 03/12] qemu: Separate formatting from saving into caps cache
Peter Krempa
pkrempa at redhat.com
Fri May 6 07:24:15 UTC 2016
On Thu, May 05, 2016 at 18:42:05 +0200, Jiri Denemark wrote:
> We will need to use the formatter directly for testing QEMU capabilities
> code.
>
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
> src/qemu/qemu_capabilities.c | 32 ++++++++++++++++++++++----------
> 1 file changed, 22 insertions(+), 10 deletions(-)
>
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index c2ba69d..862aed0 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
[...]
> @@ -3094,10 +3095,21 @@ virQEMUCapsSaveCache(virQEMUCapsPtr qemuCaps, const char *filename)
> virBufferAdjustIndent(&buf, -2);
> virBufferAddLit(&buf, "</qemuCaps>\n");
>
> - if (virBufferCheckError(&buf) < 0)
> - goto cleanup;
> + if (virBufferCheckError(&buf) == 0)
> + ret = virBufferContentAndReset(&buf);
>
> - xml = virBufferContentAndReset(&buf);
> + return ret;
> +}
> +
Two newlines to separate functions.
> +static int
> +virQEMUCapsSaveCache(virQEMUCapsPtr qemuCaps, const char *filename)
> +{
> + char *xml = NULL;
> + int ret = -1;
> +
> + xml = virQEMUCapsFormatCache(qemuCaps,
> + virGetSelfLastChanged(),
> + LIBVIR_VERSION_NUMBER);
>
> if (virFileWriteStr(filename, xml, 0600) < 0) {
> virReportSystemError(errno,
ACK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160506/b1349269/attachment-0001.sig>
More information about the libvir-list
mailing list