]> xenbits.xensource.com Git - libvirt.git/commitdiff
parallels: fix build for some older compilers
authorLaine Stump <laine@laine.org>
Fri, 26 Oct 2012 17:23:56 +0000 (13:23 -0400)
committerLaine Stump <laine@laine.org>
Fri, 26 Oct 2012 17:23:56 +0000 (13:23 -0400)
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".

src/parallels/parallels_driver.c
src/parallels/parallels_storage.c

index e8af89c2e9cd8bf21be2168df01ad54fee62942e..62db626b4697a3c1c59d6bde60867bd52801ac76 100644 (file)
@@ -1256,14 +1256,16 @@ static int
 parallelsApplySerialParams(virDomainChrDefPtr *oldserials, int nold,
                            virDomainChrDefPtr *newserials, int nnew)
 {
+    int i, j;
+
     if (nold != nnew)
         goto error;
 
-    for (int i = 0; i < nold; i++) {
+    for (i = 0; i < nold; i++) {
         virDomainChrDefPtr oldserial = oldserials[i];
         virDomainChrDefPtr newserial = NULL;
 
-        for (int j = 0; j < nnew; j++) {
+        for (j = 0; j < nnew; j++) {
             if (newserials[j]->target.port == oldserial->target.port) {
                 newserial = newserials[j];
                 break;
index 112e2883426c74fdea76e149a70c1f8f81a0971e..76d885c3621b1069fb10bb3d961d73613bea882b 100644 (file)
@@ -123,6 +123,8 @@ parallelsStorageOpen(virConnectPtr conn,
     virStorageDriverStatePtr storageState;
     int privileged = (geteuid() == 0);
     parallelsConnPtr privconn = conn->privateData;
+    size_t i;
+
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
 
     if (STRNEQ(conn->driver->name, "Parallels"))
@@ -176,7 +178,7 @@ parallelsStorageOpen(virConnectPtr conn,
         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]);
         virStoragePoolObjPtr pool;