From 9193bac260620fbeec580d709699b3e0f97b9bd7 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 21 Dec 2022 09:55:50 +0100 Subject: [PATCH] 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 --- src/qemu/qemu_capabilities.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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) -- 2.47.2