qemu: Decrease scope of variables in qemuConnectGetAllDomainStats()

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@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Michal Privoznik 2021-10-18 10:52:47 +02:00
parent c2c67fe4fd
commit 8fbffeae07

View File

@ -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);