From: Michal Privoznik Date: Wed, 21 Dec 2022 08:55:50 +0000 (+0100) Subject: qemu_capabilities: Decrease scope of @hash in virQEMUCapsProbeQMPHostCPU() X-Git-Tag: v9.0.0-rc1~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9193bac260620fbeec580d709699b3e0f97b9bd7;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Peter Krempa --- diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 3591e73e5b..e6024a2d75 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -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)