virCapabilitiesHostNUMAInitReal: Bring variables into loop
Some variables are needed only inside for() loop. They were declared at the beginning of the function because of VIR_FREE() calls, but since they are auto-freed they can be declared inside the loop. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3bab9ce34f
commit
fe75c387c4
@ -1596,22 +1596,22 @@ static int
|
|||||||
virCapabilitiesHostNUMAInitReal(virCapsHostNUMA *caps)
|
virCapabilitiesHostNUMAInitReal(virCapsHostNUMA *caps)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
unsigned long long memory;
|
|
||||||
virCapsHostNUMACellCPU *cpus = NULL;
|
virCapsHostNUMACellCPU *cpus = NULL;
|
||||||
g_autoptr(virBitmap) cpumap = NULL;
|
|
||||||
g_autofree virCapsHostNUMACellSiblingInfo *siblings = NULL;
|
|
||||||
int nsiblings = 0;
|
|
||||||
g_autofree virCapsHostNUMACellPageInfo *pageinfo = NULL;
|
|
||||||
int npageinfo;
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int ncpus = 0;
|
int ncpus = 0;
|
||||||
int cpu;
|
|
||||||
int max_node;
|
int max_node;
|
||||||
|
|
||||||
if ((max_node = virNumaGetMaxNode()) < 0)
|
if ((max_node = virNumaGetMaxNode()) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (n = 0; n <= max_node; n++) {
|
for (n = 0; n <= max_node; n++) {
|
||||||
|
g_autoptr(virBitmap) cpumap = NULL;
|
||||||
|
g_autofree virCapsHostNUMACellSiblingInfo *siblings = NULL;
|
||||||
|
int nsiblings = 0;
|
||||||
|
g_autofree virCapsHostNUMACellPageInfo *pageinfo = NULL;
|
||||||
|
int npageinfo;
|
||||||
|
unsigned long long memory;
|
||||||
|
int cpu;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if ((ncpus = virNumaGetNodeCPUs(n, &cpumap)) < 0) {
|
if ((ncpus = virNumaGetNodeCPUs(n, &cpumap)) < 0) {
|
||||||
@ -1645,8 +1645,6 @@ virCapabilitiesHostNUMAInitReal(virCapsHostNUMA *caps)
|
|||||||
ncpus, &cpus,
|
ncpus, &cpus,
|
||||||
nsiblings, &siblings,
|
nsiblings, &siblings,
|
||||||
npageinfo, &pageinfo);
|
npageinfo, &pageinfo);
|
||||||
virBitmapFree(cpumap);
|
|
||||||
cpumap = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user