Separate out the internals as they will become more complex soon.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index bfbafd04e4..e5ea57a7b7 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5901,6 +5901,21 @@ virQEMUCapsSetMicrocodeVersion(virQEMUCapsPtr qemuCaps,
}
+static void
+virQEMUCapsStripMachineAliasesForVirtType(virQEMUCapsPtr qemuCaps,
+ virDomainVirtType virtType)
+{
+ virQEMUCapsAccelPtr accel = virQEMUCapsGetAccel(qemuCaps, virtType);
+ size_t i;
+
+ for (i = 0; i < accel->nmachineTypes; i++) {
+ virQEMUCapsMachineTypePtr mach = &accel->machineTypes[i];
+
+ VIR_FREE(mach->alias);
+ }
+}
+
+
/**
* virQEMUCapsStripMachineAliases:
* @qemuCaps: capabilities object to process
@@ -5911,11 +5926,6 @@ virQEMUCapsSetMicrocodeVersion(virQEMUCapsPtr qemuCaps,
void
virQEMUCapsStripMachineAliases(virQEMUCapsPtr qemuCaps)
{
- size_t i;
-
- for (i = 0; i < qemuCaps->kvm.nmachineTypes; i++)
- VIR_FREE(qemuCaps->kvm.machineTypes[i].alias);
-
- for (i = 0; i < qemuCaps->tcg.nmachineTypes; i++)
- VIR_FREE(qemuCaps->tcg.machineTypes[i].alias);
+ virQEMUCapsStripMachineAliasesForVirtType(qemuCaps, VIR_DOMAIN_VIRT_KVM);
+ virQEMUCapsStripMachineAliasesForVirtType(qemuCaps, VIR_DOMAIN_VIRT_QEMU);
}
--
2.24.1