From 7c95619cb1d02c414288c83a2d0600f258250c32 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Mon, 14 Nov 2016 21:51:31 +0100 Subject: [PATCH] qemu: Introduce virQEMUCapsFormatCPUModels This patch moves the CPU models formatting code from virQEMUCapsFormatCache into a separate function. Signed-off-by: Jiri Denemark --- 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 234bcf93ad..85b1a662b4 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3294,6 +3294,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, "\n", cpu->name); + } + } +} + + char * virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps, time_t selfCTime, @@ -3336,12 +3351,7 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps, virBufferAsprintf(&buf, "%s\n", virArchToString(qemuCaps->arch)); - if (qemuCaps->cpuDefinitions) { - for (i = 0; i < qemuCaps->cpuDefinitions->nmodels; i++) { - virDomainCapsCPUModelPtr cpu = qemuCaps->cpuDefinitions->models + i; - virBufferEscapeString(&buf, "\n", cpu->name); - } - } + virQEMUCapsFormatCPUModels(qemuCaps, &buf); for (i = 0; i < qemuCaps->nmachineTypes; i++) { virBufferEscapeString(&buf, "