---
src/storage/storage_backend.c | 14 +++++++-------
src/storage/storage_backend_disk.c | 2 +-
src/storage/storage_backend_iscsi.c | 10 +++++-----
src/storage/storage_backend_logical.c | 6 +++---
src/storage/storage_driver.c | 26 +++++++++++++-------------
5 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 01a404e..66b3ff7 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1485,14 +1485,14 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool,
return -1;
}
- for (i = 0 ; i < nregex ; i++) {
+ for (i = 0; i < nregex; i++) {
err = regcomp(®[i], regex[i], REG_EXTENDED);
if (err != 0) {
char error[100];
regerror(err, ®[i], error, sizeof(error));
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to compile regex %s"), error);
- for (j = 0 ; j <= i ; j++)
+ for (j = 0; j <= i; j++)
regfree(®[j]);
VIR_FREE(reg);
return -1;
@@ -1538,7 +1538,7 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool,
if (!p)
p = line;
- for (i = 0 ; i <= maxReg && i < nregex ; i++) {
+ for (i = 0; i <= maxReg && i < nregex; i++) {
if (regexec(®[i], p, nvars[i]+1, vars, 0) == 0) {
maxReg++;
@@ -1546,7 +1546,7 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool,
ngroup = 0;
/* NULL terminate each captured group in the line */
- for (j = 0 ; j < nvars[i] ; j++) {
+ for (j = 0; j < nvars[i]; j++) {
/* NB vars[0] is the full pattern, so we offset j by 1 */
p[vars[j+1].rm_eo] = '\0';
if (VIR_STRDUP(groups[ngroup++], p + vars[j+1].rm_so) < 0)
@@ -1559,7 +1559,7 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool,
goto cleanup;
/* Release matches & restart to matching the first regex */
- for (j = 0 ; j < totgroups ; j++)
+ for (j = 0; j < totgroups; j++)
VIR_FREE(groups[j]);
maxReg = 0;
ngroup = 0;
@@ -1571,13 +1571,13 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool,
ret = virCommandWait(cmd, NULL);
cleanup:
if (groups) {
- for (j = 0 ; j < totgroups ; j++)
+ for (j = 0; j < totgroups; j++)
VIR_FREE(groups[j]);
VIR_FREE(groups);
}
VIR_FREE(vars);
- for (i = 0 ; i < nregex ; i++)
+ for (i = 0; i < nregex; i++)
regfree(®[i]);
VIR_FREE(reg);
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 09c2d2c..d0b91f9 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -553,7 +553,7 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,
aligned to the cylinder boundary */
extraBytes = cylinderSize - (allocation % cylinderSize);
- for (i = 0 ; i < dev->nfreeExtent ; i++) {
+ for (i = 0; i < dev->nfreeExtent; i++) {
unsigned long long size =
dev->freeExtents[i].end -
dev->freeExtents[i].start;
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index a74f343..ad38ab2 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -562,7 +562,7 @@ virStorageBackendISCSIScanTargets(const char *portal,
&list, NULL) < 0)
goto cleanup;
- for (i = 0 ; i < list.ntargets ; i++) {
+ for (i = 0; i < list.ntargets; i++) {
/* We have to ignore failure, because we can't undo
* the results of 'sendtargets', unless we go scrubbing
* around in the dirt in /var/lib/iscsi.
@@ -578,7 +578,7 @@ virStorageBackendISCSIScanTargets(const char *portal,
*ntargetsret = list.ntargets;
*targetsret = list.targets;
} else {
- for (i = 0 ; i < list.ntargets ; i++) {
+ for (i = 0; i < list.ntargets; i++) {
VIR_FREE(list.targets[i]);
}
VIR_FREE(list.targets);
@@ -640,7 +640,7 @@ virStorageBackendISCSIFindPoolSources(virConnectPtr conn
ATTRIBUTE_UNUSED,
goto cleanup;
}
- for (i = 0 ; i < ntargets ; i++) {
+ for (i = 0; i < ntargets; i++) {
if (VIR_ALLOC_N(list.sources[i].devices, 1) < 0 ||
VIR_ALLOC_N(list.sources[i].hosts, 1) < 0) {
virReportOOMError();
@@ -661,13 +661,13 @@ virStorageBackendISCSIFindPoolSources(virConnectPtr conn
ATTRIBUTE_UNUSED,
cleanup:
if (list.sources) {
- for (i = 0 ; i < ntargets ; i++) {
+ for (i = 0; i < ntargets; i++) {
VIR_FREE(list.sources[i].hosts);
VIR_FREE(list.sources[i].devices);
}
VIR_FREE(list.sources);
}
- for (i = 0 ; i < ntargets ; i++)
+ for (i = 0; i < ntargets; i++)
VIR_FREE(targets[i]);
VIR_FREE(targets);
VIR_FREE(portal);
diff --git a/src/storage/storage_backend_logical.c
b/src/storage/storage_backend_logical.c
index 140d188..944aa0e 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -364,7 +364,7 @@ virStorageBackendLogicalFindPoolSourcesFunc(virStoragePoolObjPtr pool
ATTRIBUTE_
goto error;
thisSource = NULL;
- for (i = 0 ; i < sourceList->nsources; i++) {
+ for (i = 0; i < sourceList->nsources; i++) {
if (STREQ(sourceList->sources[i].name, vgname)) {
thisSource = &sourceList->sources[i];
break;
@@ -514,7 +514,7 @@ virStorageBackendLogicalBuildPool(virConnectPtr conn
ATTRIBUTE_UNUSED,
vgcmd = virCommandNewArgList(VGCREATE, pool->def->source.name, NULL);
- for (i = 0 ; i < pool->def->source.ndevice ; i++) {
+ for (i = 0; i < pool->def->source.ndevice; i++) {
virCommandPtr pvcmd;
/*
* LVM requires that the first sector is blanked if using
@@ -669,7 +669,7 @@ virStorageBackendLogicalDeletePool(virConnectPtr conn
ATTRIBUTE_UNUSED,
/* now remove the pv devices and clear them out */
ret = 0;
- for (i = 0 ; i < pool->def->source.ndevice ; i++) {
+ for (i = 0; i < pool->def->source.ndevice; i++) {
cmd = virCommandNewArgList(PVREMOVE,
pool->def->source.devices[i].path,
NULL);
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 7cf8193..a2b0c21 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -68,7 +68,7 @@ static void
storageDriverAutostart(virStorageDriverStatePtr driver) {
unsigned int i;
- for (i = 0 ; i < driver->pools.count ; i++) {
+ for (i = 0; i < driver->pools.count; i++) {
virStoragePoolObjPtr pool = driver->pools.objs[i];
virStorageBackendPtr backend;
bool started = false;
@@ -314,7 +314,7 @@ storageConnectNumOfStoragePools(virConnectPtr conn) {
unsigned int i, nactive = 0;
storageDriverLock(driver);
- for (i = 0 ; i < driver->pools.count ; i++) {
+ for (i = 0; i < driver->pools.count; i++) {
virStoragePoolObjLock(driver->pools.objs[i]);
if (virStoragePoolObjIsActive(driver->pools.objs[i]))
nactive++;
@@ -333,7 +333,7 @@ storageConnectListStoragePools(virConnectPtr conn,
int got = 0, i;
storageDriverLock(driver);
- for (i = 0 ; i < driver->pools.count && got < nnames ; i++) {
+ for (i = 0; i < driver->pools.count && got < nnames; i++) {
virStoragePoolObjLock(driver->pools.objs[i]);
if (virStoragePoolObjIsActive(driver->pools.objs[i])) {
if (VIR_STRDUP(names[got], driver->pools.objs[i]->def->name) < 0)
{
@@ -349,7 +349,7 @@ storageConnectListStoragePools(virConnectPtr conn,
cleanup:
storageDriverUnlock(driver);
- for (i = 0 ; i < got ; i++)
+ for (i = 0; i < got; i++)
VIR_FREE(names[i]);
memset(names, 0, nnames * sizeof(*names));
return -1;
@@ -361,7 +361,7 @@ storageConnectNumOfDefinedStoragePools(virConnectPtr conn) {
unsigned int i, nactive = 0;
storageDriverLock(driver);
- for (i = 0 ; i < driver->pools.count ; i++) {
+ for (i = 0; i < driver->pools.count; i++) {
virStoragePoolObjLock(driver->pools.objs[i]);
if (!virStoragePoolObjIsActive(driver->pools.objs[i]))
nactive++;
@@ -380,7 +380,7 @@ storageConnectListDefinedStoragePools(virConnectPtr conn,
int got = 0, i;
storageDriverLock(driver);
- for (i = 0 ; i < driver->pools.count && got < nnames ; i++) {
+ for (i = 0; i < driver->pools.count && got < nnames; i++) {
virStoragePoolObjLock(driver->pools.objs[i]);
if (!virStoragePoolObjIsActive(driver->pools.objs[i])) {
if (VIR_STRDUP(names[got], driver->pools.objs[i]->def->name) < 0)
{
@@ -396,7 +396,7 @@ storageConnectListDefinedStoragePools(virConnectPtr conn,
cleanup:
storageDriverUnlock(driver);
- for (i = 0 ; i < got ; i++) {
+ for (i = 0; i < got; i++) {
VIR_FREE(names[i]);
}
memset(names, 0, nnames * sizeof(*names));
@@ -1114,7 +1114,7 @@ storagePoolListVolumes(virStoragePoolPtr obj,
goto cleanup;
}
- for (i = 0 ; i < pool->volumes.count && n < maxnames ; i++) {
+ for (i = 0; i < pool->volumes.count && n < maxnames; i++) {
if (VIR_STRDUP(names[n++], pool->volumes.objs[i]->name) < 0)
goto cleanup;
}
@@ -1125,7 +1125,7 @@ storagePoolListVolumes(virStoragePoolPtr obj,
cleanup:
if (pool)
virStoragePoolObjUnlock(pool);
- for (n = 0 ; n < maxnames ; n++)
+ for (n = 0; n < maxnames; n++)
VIR_FREE(names[n]);
memset(names, 0, maxnames * sizeof(*names));
@@ -1174,7 +1174,7 @@ storagePoolListAllVolumes(virStoragePoolPtr pool,
goto cleanup;
}
- for (i = 0 ; i < obj->volumes.count; i++) {
+ for (i = 0; i < obj->volumes.count; i++) {
if (!(vol = virGetStorageVol(pool->conn, obj->def->name,
obj->volumes.objs[i]->name,
obj->volumes.objs[i]->key,
@@ -1253,7 +1253,7 @@ storageVolLookupByKey(virConnectPtr conn,
virStorageVolPtr ret = NULL;
storageDriverLock(driver);
- for (i = 0 ; i < driver->pools.count && !ret ; i++) {
+ for (i = 0; i < driver->pools.count && !ret; i++) {
virStoragePoolObjLock(driver->pools.objs[i]);
if (virStoragePoolObjIsActive(driver->pools.objs[i])) {
virStorageVolDefPtr vol =
@@ -1290,7 +1290,7 @@ storageVolLookupByPath(virConnectPtr conn,
return NULL;
storageDriverLock(driver);
- for (i = 0 ; i < driver->pools.count && !ret ; i++) {
+ for (i = 0; i < driver->pools.count && !ret; i++) {
virStoragePoolObjLock(driver->pools.objs[i]);
if (virStoragePoolObjIsActive(driver->pools.objs[i])) {
virStorageVolDefPtr vol;
@@ -2169,7 +2169,7 @@ storageVolDelete(virStorageVolPtr obj,
if (backend->deleteVol(obj->conn, pool, vol, flags) < 0)
goto cleanup;
- for (i = 0 ; i < pool->volumes.count ; i++) {
+ for (i = 0; i < pool->volumes.count; i++) {
if (pool->volumes.objs[i] == vol) {
VIR_INFO("Deleting volume '%s' from storage pool
'%s'",
vol->name, pool->def->name);
--
1.8.1.4