mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
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:
parent
c2c67fe4fd
commit
8fbffeae07
@ -18811,14 +18811,12 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
|
|||||||
virQEMUDriver *driver = conn->privateData;
|
virQEMUDriver *driver = conn->privateData;
|
||||||
virErrorPtr orig_err = NULL;
|
virErrorPtr orig_err = NULL;
|
||||||
virDomainObj **vms = NULL;
|
virDomainObj **vms = NULL;
|
||||||
virDomainObj *vm;
|
|
||||||
size_t nvms;
|
size_t nvms;
|
||||||
virDomainStatsRecordPtr *tmpstats = NULL;
|
virDomainStatsRecordPtr *tmpstats = NULL;
|
||||||
bool enforce = !!(flags & VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS);
|
bool enforce = !!(flags & VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS);
|
||||||
int nstats = 0;
|
int nstats = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
unsigned int domflags = 0;
|
|
||||||
unsigned int lflags = flags & (VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE |
|
unsigned int lflags = flags & (VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE |
|
||||||
VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT |
|
VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT |
|
||||||
VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE);
|
VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE);
|
||||||
@ -18848,12 +18846,11 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
|
|||||||
tmpstats = g_new0(virDomainStatsRecordPtr, nvms + 1);
|
tmpstats = g_new0(virDomainStatsRecordPtr, nvms + 1);
|
||||||
|
|
||||||
for (i = 0; i < nvms; i++) {
|
for (i = 0; i < nvms; i++) {
|
||||||
|
virDomainObj *vm = vms[i];
|
||||||
virDomainStatsRecordPtr tmp = NULL;
|
virDomainStatsRecordPtr tmp = NULL;
|
||||||
unsigned int privflags = 0;
|
unsigned int privflags = 0;
|
||||||
unsigned int requestedStats = stats;
|
unsigned int requestedStats = stats;
|
||||||
|
unsigned int domflags = 0;
|
||||||
domflags = 0;
|
|
||||||
vm = vms[i];
|
|
||||||
|
|
||||||
virObjectLock(vm);
|
virObjectLock(vm);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user