There are two variables (@vm and @domflags) in qemuConnectGetAllDomainStats()
that are used only within the for() loop but declared for entire function.
Bring them into the loop to make it obvious they are not used outside of it.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_driver.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9bcba4b9a4..b9cc8f8379 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18811,14 +18811,12 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
virQEMUDriver *driver = conn->privateData;
virErrorPtr orig_err = NULL;
virDomainObj **vms = NULL;
- virDomainObj *vm;
size_t nvms;
virDomainStatsRecordPtr *tmpstats = NULL;
bool enforce = !!(flags & VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS);
int nstats = 0;
size_t i;
int ret = -1;
- unsigned int domflags = 0;
unsigned int lflags = flags & (VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE |
VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT |
VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE);
@@ -18848,12 +18846,11 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
tmpstats = g_new0(virDomainStatsRecordPtr, nvms + 1);
for (i = 0; i < nvms; i++) {
+ virDomainObj *vm = vms[i];
virDomainStatsRecordPtr tmp = NULL;
unsigned int privflags = 0;
unsigned int requestedStats = stats;
-
- domflags = 0;
- vm = vms[i];
+ unsigned int domflags = 0;
virObjectLock(vm);
--
2.32.0