]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_capabilities: Decrease scope of @hash in virQEMUCapsProbeQMPHostCPU()
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 21 Dec 2022 08:55:50 +0000 (09:55 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 3 Jan 2023 16:36:21 +0000 (17:36 +0100)
The @hash variable inside of virQEMUCapsProbeQMPHostCPU() is used
only within a block, but declared at the beginning of the
function. Bring the variable declaration into the said block.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_capabilities.c

index 3591e73e5b370336bd449e6b13712a86df6c5d78..e6024a2d758e64adf001e818ae08cdeca620878c 100644 (file)
@@ -3038,7 +3038,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;
@@ -3082,12 +3081,11 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps,
         return -1;
 
     if (nonMigratable) {
+        g_autoptr(GHashTable) hash = virHashNew(NULL);
         qemuMonitorCPUProperty *prop;
         qemuMonitorCPUProperty *nmProp;
         size_t i;
 
-        hash = virHashNew(NULL);
-
         for (i = 0; i < modelInfo->nprops; i++) {
             prop = modelInfo->props + i;
             if (virHashAddEntry(hash, prop->name, prop) < 0)