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(a)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