[PATCH] Remove some C99 variable decls in parallels driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

The parallels storage driver declared some loop variables
inside the for(;;). This is not allowed by libvirt coding
standards

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>

Pushed under build breaker rule - RHEL-5 gcc chokes on them

---
 src/parallels/parallels_storage.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/parallels/parallels_storage.c b/src/parallels/parallels_storage.c
index f696fcb..ac65a1d 100644
--- a/src/parallels/parallels_storage.c
+++ b/src/parallels/parallels_storage.c
@@ -129,9 +129,11 @@ static char *parallelsMakePoolName(virConnectPtr conn, const char *path)
 {
     parallelsConnPtr privconn = conn->privateData;
     char *name;
+    unsigned int i;
 
-    for (unsigned int i = 0; i < UINT_MAX; i++) {
+    for (i = 0; i < UINT_MAX; i++) {
         bool found = false;
+        int j;
 
         if (!(name = strdup(path))) {
             virReportOOMError();
@@ -148,11 +150,11 @@ static char *parallelsMakePoolName(virConnectPtr conn, const char *path)
             return 0;
         }
 
-        for (int j = 0; j < strlen(name); j++)
+        for (j = 0; j < strlen(name); j++)
             if (name[j] == '/')
                 name[j] = '-';
 
-        for (int j = 0; j < privconn->pools.count; j++) {
+        for (j = 0; j < privconn->pools.count; j++) {
             if (STREQ(name, privconn->pools.objs[j]->def->name)) {
                 found = true;
                 break;
@@ -226,6 +228,7 @@ parallelsPoolAddByDomain(virConnectPtr conn, virDomainObjPtr dom)
     virStoragePoolObjListPtr pools = &privconn->pools;
     char *poolPath;
     virStoragePoolObjPtr pool = NULL;
+    int j;
 
     if (!(poolPath = strdup(pdom->home))) {
         virReportOOMError();
@@ -234,7 +237,7 @@ parallelsPoolAddByDomain(virConnectPtr conn, virDomainObjPtr dom)
 
     poolPath = dirname(poolPath);
 
-    for (int j = 0; j < pools->count; j++) {
+    for (j = 0; j < pools->count; j++) {
         if (STREQ(poolPath, pools->objs[j]->def->target.path)) {
             pool = pools->objs[j];
             break;
-- 
1.8.1.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]