parallels: fix build for some older compilers

Found this when building on RHEL5:

parallels/parallels_storage.c: In function 'parallelsStorageOpen':
parallels/parallels_storage.c:180: error: 'for' loop initial declaration used outside C99 mode

(and similar error in parallels_driver.c). This was in spite of
configuring with "-Wno-error".
This commit is contained in:
Laine Stump 2012-10-26 13:23:56 -04:00
parent 7083cdc7bd
commit 73ebd86d73
2 changed files with 7 additions and 3 deletions

View File

@ -1256,14 +1256,16 @@ static int
parallelsApplySerialParams(virDomainChrDefPtr *oldserials, int nold, parallelsApplySerialParams(virDomainChrDefPtr *oldserials, int nold,
virDomainChrDefPtr *newserials, int nnew) virDomainChrDefPtr *newserials, int nnew)
{ {
int i, j;
if (nold != nnew) if (nold != nnew)
goto error; goto error;
for (int i = 0; i < nold; i++) { for (i = 0; i < nold; i++) {
virDomainChrDefPtr oldserial = oldserials[i]; virDomainChrDefPtr oldserial = oldserials[i];
virDomainChrDefPtr newserial = NULL; virDomainChrDefPtr newserial = NULL;
for (int j = 0; j < nnew; j++) { for (j = 0; j < nnew; j++) {
if (newserials[j]->target.port == oldserial->target.port) { if (newserials[j]->target.port == oldserial->target.port) {
newserial = newserials[j]; newserial = newserials[j];
break; break;

View File

@ -123,6 +123,8 @@ parallelsStorageOpen(virConnectPtr conn,
virStorageDriverStatePtr storageState; virStorageDriverStatePtr storageState;
int privileged = (geteuid() == 0); int privileged = (geteuid() == 0);
parallelsConnPtr privconn = conn->privateData; parallelsConnPtr privconn = conn->privateData;
size_t i;
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
if (STRNEQ(conn->driver->name, "Parallels")) if (STRNEQ(conn->driver->name, "Parallels"))
@ -176,7 +178,7 @@ parallelsStorageOpen(virConnectPtr conn,
goto error; goto error;
} }
for (size_t i = 0; i < privconn->pools.count; i++) { for (i = 0; i < privconn->pools.count; i++) {
virStoragePoolObjLock(privconn->pools.objs[i]); virStoragePoolObjLock(privconn->pools.objs[i]);
virStoragePoolObjPtr pool; virStoragePoolObjPtr pool;