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;
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++;
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)
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;
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);
&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.
*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);
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();
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);
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;
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
/* 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);
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;
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++;
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) {
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;
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++;
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) {
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));
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;
}
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));
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,
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 =
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;
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);