[PATCH v1 2/7] qemu_capabilities: Decrease scope of @hash in virQEMUCapsProbeQMPHostCPU()

Michal Privoznik mprivozn at redhat.com
Thu Dec 22 13:01:38 UTC 2022


The @hash variable inside of virQEMUCapsProbeQMPHostCPU() is used
only within a loop, but declared at the beginning of the
function. Bring the variable declaration into the said loop.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_capabilities.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 3aba9299b1..adcd3b21a6 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3035,7 +3035,6 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps,
     const char *model = virQEMUCapsTypeIsAccelerated(virtType) ? "host" : "max";
     g_autoptr(qemuMonitorCPUModelInfo) modelInfo = NULL;
     g_autoptr(qemuMonitorCPUModelInfo) nonMigratable = NULL;
-    g_autoptr(GHashTable) hash = NULL;
     g_autoptr(virCPUDef) cpu = NULL;
     qemuMonitorCPUModelExpansionType type;
     bool fail_no_props = true;
@@ -3079,6 +3078,7 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps,
         return -1;
 
     if (nonMigratable) {
+        g_autoptr(GHashTable) hash = NULL;
         qemuMonitorCPUProperty *prop;
         qemuMonitorCPUProperty *nmProp;
         size_t i;
-- 
2.38.2



More information about the libvir-list mailing list