qemu_capabilities: Decrease scope of @hash in virQEMUCapsProbeQMPHostCPU()

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>
This commit is contained in:
Michal Privoznik 2022-12-21 09:55:50 +01:00
parent 5ea0315f60
commit 9193bac260

View 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)