virDomainIOThreadIDDefArrayInit: Decrease scope of @iothrid
In virDomainIOThreadIDDefArrayInit() the variable @iothrid is used only inside a loop but is declared for whole function. Bring the variable into the loop so that it's obvious that the variable is not used elsewhere. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
d10b6b4c89
commit
13a8c0aa61
@ -3509,7 +3509,6 @@ virDomainIOThreadIDDefArrayInit(virDomainDef *def,
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
ssize_t nxt = -1;
|
ssize_t nxt = -1;
|
||||||
virDomainIOThreadIDDef *iothrid = NULL;
|
|
||||||
g_autoptr(virBitmap) thrmap = NULL;
|
g_autoptr(virBitmap) thrmap = NULL;
|
||||||
|
|
||||||
/* Same value (either 0 or some number), then we have none to fill in or
|
/* Same value (either 0 or some number), then we have none to fill in or
|
||||||
@ -3534,6 +3533,8 @@ virDomainIOThreadIDDefArrayInit(virDomainDef *def,
|
|||||||
|
|
||||||
/* Populate iothreadids[] using the set bit number from thrmap */
|
/* Populate iothreadids[] using the set bit number from thrmap */
|
||||||
while (def->niothreadids < iothreads) {
|
while (def->niothreadids < iothreads) {
|
||||||
|
g_autoptr(virDomainIOThreadIDDef) iothrid = NULL;
|
||||||
|
|
||||||
if ((nxt = virBitmapNextSetBit(thrmap, nxt)) < 0) {
|
if ((nxt = virBitmapNextSetBit(thrmap, nxt)) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("failed to populate iothreadids"));
|
_("failed to populate iothreadids"));
|
||||||
@ -3542,7 +3543,7 @@ virDomainIOThreadIDDefArrayInit(virDomainDef *def,
|
|||||||
iothrid = g_new0(virDomainIOThreadIDDef, 1);
|
iothrid = g_new0(virDomainIOThreadIDDef, 1);
|
||||||
iothrid->iothread_id = nxt;
|
iothrid->iothread_id = nxt;
|
||||||
iothrid->autofill = true;
|
iothrid->autofill = true;
|
||||||
def->iothreadids[def->niothreadids++] = iothrid;
|
def->iothreadids[def->niothreadids++] = g_steal_pointer(&iothrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user