This patch moves the CPU models formatting code from
virQEMUCapsFormatCache into a separate function.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 7abdc2b..aa64d08 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3292,6 +3292,21 @@ virQEMUCapsLoadCache(virCapsPtr caps,
}
+static void
+virQEMUCapsFormatCPUModels(virQEMUCapsPtr qemuCaps,
+ virBufferPtr buf)
+{
+ size_t i;
+
+ if (qemuCaps->cpuDefinitions) {
+ for (i = 0; i < qemuCaps->cpuDefinitions->nmodels; i++) {
+ virDomainCapsCPUModelPtr cpu = qemuCaps->cpuDefinitions->models + i;
+ virBufferEscapeString(buf, "<cpu name='%s'/>\n",
cpu->name);
+ }
+ }
+}
+
+
char *
virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps,
time_t selfCTime,
@@ -3334,12 +3349,7 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps,
virBufferAsprintf(&buf, "<arch>%s</arch>\n",
virArchToString(qemuCaps->arch));
- if (qemuCaps->cpuDefinitions) {
- for (i = 0; i < qemuCaps->cpuDefinitions->nmodels; i++) {
- virDomainCapsCPUModelPtr cpu = qemuCaps->cpuDefinitions->models + i;
- virBufferEscapeString(&buf, "<cpu name='%s'/>\n",
cpu->name);
- }
- }
+ virQEMUCapsFormatCPUModels(qemuCaps, &buf);
for (i = 0; i < qemuCaps->nmachineTypes; i++) {
virBufferEscapeString(&buf, "<machine name='%s'",
--
2.10.2