On Thu, Apr 13, 2017 at 03:32:53PM +0200, Jiri Denemark wrote:
We need to store several CPU related data structure for both KVM and
TCG. So instead of keeping two different copies of everything let's
make a virQEMUCapsHostCPUData struct and use it twice.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 166 +++++++++++++++++++++----------------------
1 file changed, 81 insertions(+), 85 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6f0d6287e..f914154be 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
[...]
@@ -2143,17 +2141,12 @@ virQEMUCapsHostCPUDataCopy(virQEMUCapsPtr
dst,
static void
-virQEMUCapsHostCPUDataClear(virQEMUCapsPtr qemuCaps)
+virQEMUCapsHostCPUDataClear(virQEMUCapsHostCPUDataPtr cpuData)
{
- qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo);
- qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo);
- qemuCaps->kvmCPUModelInfo = NULL;
- qemuCaps->tcgCPUModelInfo = NULL;
+ qemuMonitorCPUModelInfoFree(cpuData->info);
+ virCPUDefFree(cpuData->reported);
- virCPUDefFree(qemuCaps->kvmCPUModel);
- virCPUDefFree(qemuCaps->tcgCPUModel);
- qemuCaps->kvmCPUModel = NULL;
- qemuCaps->tcgCPUModel = NULL;
+ memset(cpuData, '\0', sizeof(*cpuData));
We tend to use memset(ptr, 0, size); :)
}
ACK
Pavel