[libvirt-php][PATCH 10/14] libvirt-php.c: Fix code styling issues with for loops

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

 



for loop should be written with spaces
ex:
for (i = 0; i < MAX; i++) {
    ...
}

Signed-off-by: Katerina Koukiou <k.koukiou@xxxxxxxxx>
---
 src/libvirt-php.c | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index dea608e..ced4031 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -2292,7 +2292,7 @@ PHP_FUNCTION(libvirt_connect)
         creds[0].count = j;
         libvirt_virConnectAuth.cbdata = (void*)creds;
         conn->conn = virConnectOpenAuth(url, &libvirt_virConnectAuth, readonly ? VIR_CONNECT_RO : 0);
-        for (i = 0;i < creds[0].count;i++)
+        for (i = 0; i < creds[0].count; i++)
             efree(creds[i].result);
         efree(creds);
     }
@@ -6882,7 +6882,7 @@ PHP_FUNCTION(libvirt_domain_memory_stats)
         RETURN_FALSE;
     LONGLONG_INIT;
     array_init(return_value);
-    for (i = 0;i<retval;i++)
+    for (i = 0; i < retval; i++)
         LONGLONG_INDEX(return_value, stats[i].tag, stats[i].val)
 }
 
@@ -7783,7 +7783,7 @@ PHP_FUNCTION(libvirt_list_domain_snapshots)
         RETURN_FALSE;
     } else {
         array_init(return_value);
-        for (i = 0;i<count;i++) {
+        for (i = 0; i < count; i++) {
             VIRT_ADD_NEXT_INDEX_STRING(return_value, names[i]);
             free(names[i]);
         }
@@ -7898,7 +7898,7 @@ PHP_FUNCTION(libvirt_storagepool_list_volumes)
 
     if ((count != expectedcount) || (count<0))
 		RETURN_FALSE;
-    for (i = 0;i<count;i++) {
+    for (i = 0; i < count; i++) {
         VIRT_ADD_NEXT_INDEX_STRING(return_value,  names[i]);
         free(names[i]);
     }
@@ -8788,7 +8788,7 @@ PHP_FUNCTION(libvirt_list_storagepools)
     }
 
     array_init(return_value);
-    for (i = 0;i<count;i++) {
+    for (i = 0; i < count; i++) {
         VIRT_ADD_NEXT_INDEX_STRING(return_value,  names[i]);
         free(names[i]);
     }
@@ -8840,7 +8840,7 @@ PHP_FUNCTION(libvirt_list_active_storagepools)
         RETURN_FALSE;
     }
     array_init(return_value);
-    for (i = 0;i<count;i++) {
+    for (i = 0; i < count; i++) {
         VIRT_ADD_NEXT_INDEX_STRING(return_value,  names[i]);
         free(names[i]);
     }
@@ -8914,7 +8914,7 @@ PHP_FUNCTION(libvirt_list_domains)
     DPRINTF("%s: virConnectListDomains returned %d domains\n", PHPFUNC, count);
 
     array_init(return_value);
-    for (i = 0;i<count;i++) {
+    for (i = 0; i < count; i++) {
         domain = virDomainLookupByID(conn->conn, ids[i]);
         resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, domain, 1 TSRMLS_CC);
         if (domain != NULL) {
@@ -8952,7 +8952,7 @@ PHP_FUNCTION(libvirt_list_domains)
         RETURN_FALSE;
     }
 
-    for (i = 0;i<count;i++) {
+    for (i = 0; i < count; i++) {
         VIRT_ADD_NEXT_INDEX_STRING(return_value, names[i]);
         DPRINTF("%s: Found inactive domain %s\n", PHPFUNC, names[i]);
         free(names[i]);
@@ -8997,7 +8997,7 @@ PHP_FUNCTION(libvirt_list_domain_resources)
         RETURN_FALSE;
     }
     array_init(return_value);
-    for (i = 0;i<count;i++) {
+    for (i = 0; i < count; i++) {
         domain = virDomainLookupByID(conn->conn, ids[i]);
         if (domain != NULL) {
             res_domain = (php_libvirt_domain *)emalloc(sizeof(php_libvirt_domain));
@@ -9027,7 +9027,7 @@ PHP_FUNCTION(libvirt_list_domain_resources)
         efree(names);
         RETURN_FALSE;
     }
-    for (i = 0;i<count;i++) {
+    for (i = 0; i < count; i++) {
         domain = virDomainLookupByName(conn->conn, names[i]);
         if (domain != NULL) {
             res_domain = (php_libvirt_domain *)emalloc(sizeof(php_libvirt_domain));
@@ -9078,9 +9078,8 @@ PHP_FUNCTION(libvirt_list_active_domain_ids)
         RETURN_FALSE;
     }
     array_init(return_value);
-    for (i = 0;i<count;i++) {
+    for (i = 0; i < count; i++)
         add_next_index_long(return_value,  ids[i]);
-    }
     efree(ids);
 }
 
@@ -9115,7 +9114,7 @@ PHP_FUNCTION(libvirt_list_active_domains)
     }
 
     array_init(return_value);
-    for (i = 0;i<count;i++) {
+    for (i = 0; i < count; i++) {
         domain = virDomainLookupByID(conn->conn, ids[i]);
         if (domain != NULL) {
             if (!(name = virDomainGetName(domain))) {
@@ -9161,7 +9160,7 @@ PHP_FUNCTION(libvirt_list_inactive_domains)
     }
 
     array_init(return_value);
-    for (i = 0;i<count;i++) {
+    for (i = 0; i < count; i++) {
         VIRT_ADD_NEXT_INDEX_STRING(return_value,  names[i]);
         free(names[i]);
     }
@@ -9200,7 +9199,7 @@ PHP_FUNCTION(libvirt_list_networks)
             RETURN_FALSE;
         }
 
-        for (i = 0;i<count;i++) {
+        for (i = 0; i < count; i++) {
             VIRT_ADD_NEXT_INDEX_STRING(return_value,  names[i]);
             free(names[i]);
         }
@@ -9219,7 +9218,7 @@ PHP_FUNCTION(libvirt_list_networks)
             RETURN_FALSE;
         }
 
-        for (i = 0;i<count;i++) {
+        for (i = 0; i < count; i++) {
             VIRT_ADD_NEXT_INDEX_STRING(return_value, names[i]);
             free(names[i]);
         }
@@ -9263,7 +9262,7 @@ PHP_FUNCTION(libvirt_list_nodedevs)
     }
 
     array_init(return_value);
-    for (i = 0;i<count;i++) {
+    for (i = 0; i < count; i++) {
         VIRT_ADD_NEXT_INDEX_STRING(return_value,  names[i]);
         free(names[i]);
     }
@@ -9335,7 +9334,7 @@ PHP_FUNCTION(libvirt_nodedev_capabilities)
         RETURN_FALSE;
 
     array_init(return_value);
-    for (i = 0;i<count;i++) {
+    for (i = 0; i < count; i++) {
         VIRT_ADD_NEXT_INDEX_STRING(return_value, names[i]);
         free(names[i]);
     }
-- 
2.7.3

--
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]