We document that our coding style is to use postfix increment in for() loops rather than prefix. This change was generated by the following sed script: for i in $(git grep -l "for (.*; ++.*)"); do \ sed -i 's/\(for (.*; \)++\(.*\))/\1\2++)/' $i; \ done Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- examples/c/misc/openauth.c | 2 +- src/conf/node_device_conf.c | 2 +- src/cpu/cpu.c | 2 +- src/esx/esx_driver.c | 8 +-- src/esx/esx_network_driver.c | 8 +-- src/esx/esx_storage_backend_iscsi.c | 4 +- src/esx/esx_storage_backend_vmfs.c | 4 +- src/esx/esx_storage_driver.c | 12 ++--- src/esx/esx_vi.c | 14 ++--- src/hyperv/hyperv_driver.c | 4 +- src/hyperv/hyperv_network_driver.c | 2 +- src/libxl/libxl_capabilities.c | 2 +- src/libxl/libxl_driver.c | 10 ++-- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_domain.c | 4 +- src/qemu/qemu_migration_params.c | 2 +- src/qemu/qemu_process.c | 6 +-- src/remote/remote_daemon_dispatch.c | 6 +-- src/remote/remote_driver.c | 14 ++--- src/rpc/gendispatch.pl | 2 +- src/rpc/virnetclient.c | 2 +- src/rpc/virnetlibsshsession.c | 6 +-- .../storage_source_backingstore.c | 4 +- src/test/test_driver.c | 4 +- src/util/vircommand.c | 2 +- src/util/virtypedparam.c | 4 +- src/util/viruri.c | 2 +- src/vbox/vbox_XPCOMCGlue.c | 6 +-- src/vbox/vbox_common.c | 22 ++++---- src/vbox/vbox_storage.c | 6 +-- src/vmware/vmware_conf.c | 2 +- src/vmx/vmx.c | 54 +++++++++---------- src/vz/vz_driver.c | 2 +- src/vz/vz_sdk.c | 28 +++++----- tests/esxutilstest.c | 8 +-- tests/openvzutilstest.c | 2 +- tests/testutilsqemu.c | 2 +- tests/utiltest.c | 14 ++--- tests/virtypedparamtest.c | 2 +- 39 files changed, 141 insertions(+), 141 deletions(-) diff --git a/examples/c/misc/openauth.c b/examples/c/misc/openauth.c index 4c9dd34be3..98eb4c3bd4 100644 --- a/examples/c/misc/openauth.c +++ b/examples/c/misc/openauth.c @@ -166,7 +166,7 @@ authCallback(virConnectCredentialPtr cred, unsigned int ncred, void *cbdata) * For example the ESX driver passes the hostname of the ESX or vCenter * server as challenge. This allows a auth callback to return the * proper credentials. */ - for (i = 0; i < ncred; ++i) { + for (i = 0; i < ncred; i++) { switch (cred[i].type) { case VIR_CRED_AUTHNAME: cred[i].result = strdup(authData->username); diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 332b12f997..346535695a 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1236,7 +1236,7 @@ virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr ctxt, if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0) return -1; - for (i = 0; i < n; ++i) { + for (i = 0; i < n; i++) { g_autofree char *type = NULL; type = virXMLPropString(nodes[i], "type"); diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index b4965f3ee0..7d280a608e 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -704,7 +704,7 @@ int virCPUCheckForbiddenFeatures(virCPUDef *guest, const virCPUDef *host) { size_t i; - for (i = 0; i < guest->nfeatures; ++i) { + for (i = 0; i < guest->nfeatures; i++) { virCPUFeatureDef *feature; if (guest->features[i].policy != VIR_CPU_FEATURE_FORBID) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 75eee49775..75ce796f17 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2773,7 +2773,7 @@ esxConnectListDefinedDomains(virConnectPtr conn, char **const names, int maxname cleanup: if (! success) { - for (i = 0; i < count; ++i) + for (i = 0; i < count; i++) VIR_FREE(names[i]); count = -1; @@ -2977,7 +2977,7 @@ esxDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags) goto cleanup; } - for (i = 0; i < def->ndisks; ++i) { + for (i = 0; i < def->ndisks; i++) { if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK && virDomainDiskGetType(def->disks[i]) == VIR_STORAGE_TYPE_FILE) { disk = def->disks[i]; @@ -3524,7 +3524,7 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain, goto cleanup; } - for (i = 0; i < nparams; ++i) { + for (i = 0; i < nparams; i++) { if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_RESERVATION)) { if (esxVI_Long_Alloc(&spec->cpuAllocation->reservation) < 0) goto cleanup; @@ -4635,7 +4635,7 @@ esxDomainSetMemoryParameters(virDomainPtr domain, virTypedParameterPtr params, goto cleanup; } - for (i = 0; i < nparams; ++i) { + for (i = 0; i < nparams; i++) { if (STREQ(params[i].field, VIR_DOMAIN_MEMORY_MIN_GUARANTEE)) { if (esxVI_Long_Alloc(&spec->memoryAllocation->reservation) < 0) goto cleanup; diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c index 0a0a3dda89..517e3391cf 100644 --- a/src/esx/esx_network_driver.c +++ b/src/esx/esx_network_driver.c @@ -351,7 +351,7 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml) if (esxVI_LookupHostPortGroupList(priv->primary, &hostPortGroupList) < 0) goto cleanup; - for (i = 0; i < def->nPortGroups; ++i) { + for (i = 0; i < def->nPortGroups; i++) { for (hostPortGroup = hostPortGroupList; hostPortGroup; hostPortGroup = hostPortGroup->_next) { if (STREQ(def->portGroups[i].name, hostPortGroup->spec->name)) { @@ -383,7 +383,7 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml) if (esxVI_LookupPhysicalNicList(priv->primary, &physicalNicList) < 0) goto cleanup; - for (i = 0; i < def->forward.nifs; ++i) { + for (i = 0; i < def->forward.nifs; i++) { bool found = false; if (def->forward.ifs[i].type != @@ -439,7 +439,7 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml) } /* Create HostPortGroup(s) */ - for (i = 0; i < def->nPortGroups; ++i) { + for (i = 0; i < def->nPortGroups; i++) { esxVI_HostPortGroupSpec_Free(&hostPortGroupSpec); if (esxVI_HostPortGroupSpec_Alloc(&hostPortGroupSpec) < 0 || @@ -912,7 +912,7 @@ esxConnectListAllNetworks(virConnectPtr conn, cleanup: if (ret < 0) { if (nets && *nets) { - for (i = 0; i < count; ++i) + for (i = 0; i < count; i++) g_free((*nets)[i]); g_clear_pointer(nets, g_free); } diff --git a/src/esx/esx_storage_backend_iscsi.c b/src/esx/esx_storage_backend_iscsi.c index d89b5a4ba8..49c0847ade 100644 --- a/src/esx/esx_storage_backend_iscsi.c +++ b/src/esx/esx_storage_backend_iscsi.c @@ -136,7 +136,7 @@ esxConnectListStoragePools(virConnectPtr conn, char **const names, cleanup: if (! success) { - for (i = 0; i < count; ++i) + for (i = 0; i < count; i++) VIR_FREE(names[i]); } @@ -425,7 +425,7 @@ esxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, cleanup: if (! success) { - for (i = 0; i < count; ++i) + for (i = 0; i < count; i++) VIR_FREE(names[i]); count = -1; diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backend_vmfs.c index cb2be59a33..011b4c5ebb 100644 --- a/src/esx/esx_storage_backend_vmfs.c +++ b/src/esx/esx_storage_backend_vmfs.c @@ -197,7 +197,7 @@ esxConnectListStoragePools(virConnectPtr conn, char **const names, cleanup: if (! success) { - for (i = 0; i < count; ++i) + for (i = 0; i < count; i++) VIR_FREE(names[i]); count = -1; @@ -651,7 +651,7 @@ esxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, cleanup: if (! success) { - for (i = 0; i < count; ++i) + for (i = 0; i < count; i++) VIR_FREE(names[i]); count = -1; diff --git a/src/esx/esx_storage_driver.c b/src/esx/esx_storage_driver.c index 056b340a08..c6a93cd505 100644 --- a/src/esx/esx_storage_driver.c +++ b/src/esx/esx_storage_driver.c @@ -63,7 +63,7 @@ esxConnectNumOfStoragePools(virConnectPtr conn) if (esxVI_EnsureSession(priv->primary) < 0) return -1; - for (i = 0; i < LAST_BACKEND; ++i) { + for (i = 0; i < LAST_BACKEND; i++) { tmp = backends[i]->connectNumOfStoragePools(conn); if (tmp < 0) @@ -92,7 +92,7 @@ esxConnectListStoragePools(virConnectPtr conn, char **const names, int maxnames) if (esxVI_EnsureSession(priv->primary) < 0) return -1; - for (i = 0; i < LAST_BACKEND; ++i) { + for (i = 0; i < LAST_BACKEND; i++) { tmp = backends[i]->connectListStoragePools(conn, &names[count], maxnames - count); if (tmp < 0) @@ -105,7 +105,7 @@ esxConnectListStoragePools(virConnectPtr conn, char **const names, int maxnames) cleanup: if (! success) { - for (i = 0; i < count; ++i) + for (i = 0; i < count; i++) VIR_FREE(names[i]); count = -1; @@ -148,7 +148,7 @@ esxStoragePoolLookupByName(virConnectPtr conn, const char *name) if (esxVI_EnsureSession(priv->primary) < 0) return NULL; - for (i = 0; i < LAST_BACKEND; ++i) { + for (i = 0; i < LAST_BACKEND; i++) { pool = backends[i]->storagePoolLookupByName(conn, name); if (pool) @@ -175,7 +175,7 @@ esxStoragePoolLookupByUUID(virConnectPtr conn, const unsigned char *uuid) return NULL; /* invoke backend drive method to search all known pools */ - for (i = 0; i < LAST_BACKEND; ++i) { + for (i = 0; i < LAST_BACKEND; i++) { pool = backends[i]->storagePoolLookupByUUID(conn, uuid); if (pool) @@ -369,7 +369,7 @@ esxStorageVolLookupByKey(virConnectPtr conn, const char *key) if (esxVI_EnsureSession(priv->primary) < 0) return NULL; - for (i = 0; i < LAST_BACKEND; ++i) { + for (i = 0; i < LAST_BACKEND; i++) { volume = backends[i]->storageVolLookupByKey(conn, key); if (volume) diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index ebc6d9eb69..d01ef327a4 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -526,7 +526,7 @@ ESX_VI__TEMPLATE__FREE(SharedCURL, if (item->handle) curl_share_cleanup(item->handle); - for (i = 0; i < G_N_ELEMENTS(item->locks); ++i) + for (i = 0; i < G_N_ELEMENTS(item->locks); i++) virMutexDestroy(&item->locks[i]); }) @@ -566,7 +566,7 @@ esxVI_SharedCURL_Add(esxVI_SharedCURL *shared, esxVI_CURL *curl) curl_share_setopt(shared->handle, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS); - for (i = 0; i < G_N_ELEMENTS(shared->locks); ++i) { + for (i = 0; i < G_N_ELEMENTS(shared->locks); i++) { if (virMutexInit(&shared->locks[i]) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not initialize a CURL (share) mutex")); @@ -1434,7 +1434,7 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration, return -1; } - for (i = 0; enumeration->values[i].name; ++i) { + for (i = 0; enumeration->values[i].name; i++) { if (STREQ(anyType->value, enumeration->values[i].name)) { *value = enumeration->values[i].value; return 0; @@ -1464,7 +1464,7 @@ esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration, return 0; } - for (i = 0; enumeration->values[i].name; ++i) { + for (i = 0; enumeration->values[i].name; i++) { if (value == enumeration->values[i].value) { name = enumeration->values[i].name; break; @@ -1504,7 +1504,7 @@ esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration, if (esxVI_String_DeserializeValue(node, &name) < 0) return -1; - for (i = 0; enumeration->values[i].name; ++i) { + for (i = 0; enumeration->values[i].name; i++) { if (STREQ(name, enumeration->values[i].name)) { *value = enumeration->values[i].value; result = 0; @@ -2576,7 +2576,7 @@ esxVI_GetSnapshotTreeNames(esxVI_VirtualMachineSnapshotTree *snapshotTreeList, return count; failure: - for (i = 0; i < count; ++i) + for (i = 0; i < count; i++) VIR_FREE(names[i]); return -1; @@ -4365,7 +4365,7 @@ esxVI_ParseHostCpuIdInfo(esxVI_ParsedHostCpuIdInfo *parsedHostCpuIdInfo, parsedHostCpuIdInfo->level = hostCpuIdInfo->level->value; - for (r = 0; r < 4; ++r) { + for (r = 0; r < 4; r++) { if (strlen(input[r]) != expectedLength) { virReportError(VIR_ERR_INTERNAL_ERROR, _("HostCpuIdInfo register '%s' has an unexpected length"), diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index ff20d5548b..1735cd2ca9 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -2844,7 +2844,7 @@ hypervConnectListDefinedDomains(virConnectPtr conn, char **const names, int maxn cleanup: if (!success) { - for (i = 0; i < count; ++i) + for (i = 0; i < count; i++) VIR_FREE(names[i]); count = -1; @@ -3560,7 +3560,7 @@ hypervConnectListAllDomains(virConnectPtr conn, cleanup: if (doms) { - for (i = 0; i < count; ++i) + for (i = 0; i < count; i++) virObjectUnref(doms[i]); VIR_FREE(doms); diff --git a/src/hyperv/hyperv_network_driver.c b/src/hyperv/hyperv_network_driver.c index 93ef01c9aa..2600c14156 100644 --- a/src/hyperv/hyperv_network_driver.c +++ b/src/hyperv/hyperv_network_driver.c @@ -145,7 +145,7 @@ hypervConnectListAllNetworks(virConnectPtr conn, cleanup: if (ret < 0 && nets && *nets) { - for (i = 0; i < count; ++i) + for (i = 0; i < count; i++) VIR_FREE((*nets)[i]); VIR_FREE(*nets); } diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index b4bd1d7e62..4d92454c43 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -504,7 +504,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCaps *caps) } } - for (i = 0; i < nr_guest_archs; ++i) { + for (i = 0; i < nr_guest_archs; i++) { virCapsGuest *guest; char const *const xen_machines[] = { guest_archs[i].hvm ? "xenfv" : diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 0c3c53c1d1..846fc60c98 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -2280,7 +2280,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, maplen = VIR_CPU_MAPLEN(nvcpus); bitmask = g_new0(uint8_t, maplen); - for (i = 0; i < nvcpus; ++i) { + for (i = 0; i < nvcpus; i++) { pos = i / 8; bitmask[pos] |= 1 << (i % 8); } @@ -2573,7 +2573,7 @@ libxlDomainGetVcpus(virDomainPtr dom, virVcpuInfoPtr info, int maxinfo, if (cpumaps && maplen > 0) memset(cpumaps, 0, maplen * maxinfo); - for (i = 0; i < maxcpu && i < maxinfo; ++i) { + for (i = 0; i < maxcpu && i < maxinfo; i++) { info[i].number = vcpuinfo[i].vcpuid; info[i].cpu = vcpuinfo[i].cpu; info[i].cpuTime = vcpuinfo[i].vcpu_time; @@ -4714,7 +4714,7 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom, goto endjob; } - for (i = 0; i < nparams; ++i) { + for (i = 0; i < nparams; i++) { virTypedParameterPtr param = ¶ms[i]; if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_WEIGHT)) @@ -5098,7 +5098,7 @@ libxlDomainGetPerCPUStats(libxlDriverPrivate *driver, goto cleanup; } - for (i = start_cpu; i < maxcpu && i < ncpus; ++i) { + for (i = start_cpu; i < maxcpu && i < ncpus; i++) { if (virTypedParameterAssign(¶ms[(i-start_cpu)], VIR_DOMAIN_CPU_STATS_CPUTIME, VIR_TYPED_PARAM_ULLONG, @@ -5509,7 +5509,7 @@ libxlDomainBlockStatsGather(virDomainObj *vm, } else { size_t i; - for (i = 0; i < vm->def->ndisks; ++i) { + for (i = 0; i < vm->def->ndisks; i++) { if (libxlDomainBlockStatsGatherSingle(vm, vm->def->disks[i]->dst, stats) < 0) return ret; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6af1faa3cd..c61ab87cb2 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10127,7 +10127,7 @@ qemuBuildCommandLineValidate(virQEMUDriver *driver, } } - for (i = 0; i < def->ngraphics; ++i) { + for (i = 0; i < def->ngraphics; i++) { switch (def->graphics[i]->type) { case VIR_DOMAIN_GRAPHICS_TYPE_SDL: ++sdl; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 89e03fdf72..f2e25edc02 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4112,10 +4112,10 @@ qemuDomainRecheckInternalPaths(virDomainDef *def, size_t i = 0; size_t j = 0; - for (i = 0; i < def->ngraphics; ++i) { + for (i = 0; i < def->ngraphics; i++) { virDomainGraphicsDef *graphics = def->graphics[i]; - for (j = 0; j < graphics->nListens; ++j) { + for (j = 0; j < graphics->nListens; j++) { virDomainGraphicsListenDef *glisten = &graphics->listens[j]; /* This will happen only if we parse XML from old libvirts where diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c index 018e62cf6e..3df055789a 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -634,7 +634,7 @@ qemuMigrationParamsDump(qemuMigrationParams *migParams, *flags |= VIR_MIGRATE_COMPRESSED; } - for (i = 0; i < QEMU_MIGRATION_COMPRESS_LAST; ++i) { + for (i = 0; i < QEMU_MIGRATION_COMPRESS_LAST; i++) { if ((migParams->compMethods & (1ULL << i)) && virTypedParamsAddString(params, nparams, maxparams, VIR_MIGRATE_PARAM_COMPRESSION, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 7487e12640..f3b38e0cbc 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3052,7 +3052,7 @@ qemuProcessInitPasswords(virQEMUDriver *driver, g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); size_t i; - for (i = 0; i < vm->def->ngraphics; ++i) { + for (i = 0; i < vm->def->ngraphics; i++) { virDomainGraphicsDef *graphics = vm->def->graphics[i]; if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { ret = qemuDomainChangeGraphicsPasswords(driver, vm, @@ -5098,7 +5098,7 @@ qemuProcessSetupGraphics(virQEMUDriver *driver, } } - for (i = 0; i < vm->def->ngraphics; ++i) { + for (i = 0; i < vm->def->ngraphics; i++) { graphics = vm->def->graphics[i]; if (qemuProcessGraphicsAllocatePorts(driver, graphics, allocate) < 0) @@ -8062,7 +8062,7 @@ void qemuProcessStop(virQEMUDriver *driver, /* Remove VNC and Spice ports from port reservation bitmap, but only if they were reserved by the driver (autoport=yes) */ - for (i = 0; i < vm->def->ngraphics; ++i) { + for (i = 0; i < vm->def->ngraphics; i++) { virDomainGraphicsDef *graphics = vm->def->graphics[i]; if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { if (graphics->data.vnc.autoport) { diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c index 65aa20f7d1..10f0fd9be8 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -2799,7 +2799,7 @@ remoteDispatchDomainGetVcpus(virNetServer *server G_GNUC_UNUSED, ret->info.info_len = info_len; ret->info.info_val = g_new0(remote_vcpu_info, info_len); - for (i = 0; i < info_len; ++i) { + for (i = 0; i < info_len; i++) { ret->info.info_val[i].number = info[i].number; ret->info.info_val[i].state = info[i].state; ret->info.info_val[i].cpu_time = info[i].cpuTime; @@ -3217,7 +3217,7 @@ remoteDispatchNodeGetCPUStats(virNetServer *server G_GNUC_UNUSED, ret->params.params_len = nparams; ret->params.params_val = g_new0(remote_node_get_cpu_stats, nparams); - for (i = 0; i < nparams; ++i) { + for (i = 0; i < nparams; i++) { /* remoteDispatchClientRequest will free this: */ ret->params.params_val[i].field = g_strdup(params[i].field); @@ -3284,7 +3284,7 @@ remoteDispatchNodeGetMemoryStats(virNetServer *server G_GNUC_UNUSED, ret->params.params_len = nparams; ret->params.params_val = g_new0(remote_node_get_memory_stats, nparams); - for (i = 0; i < nparams; ++i) { + for (i = 0; i < nparams; i++) { /* remoteDispatchClientRequest will free this: */ ret->params.params_val[i].field = g_strdup(params[i].field); diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index c03c68ec30..91f54212ab 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1487,7 +1487,7 @@ remoteNodeGetCPUStats(virConnectPtr conn, *nparams = ret.params.params_len; /* Deserialise the result. */ - for (i = 0; i < *nparams; ++i) { + for (i = 0; i < *nparams; i++) { if (virStrcpyStatic(params[i].field, ret.params.params_val[i].field) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Stats %s too big for destination"), @@ -1551,7 +1551,7 @@ remoteNodeGetMemoryStats(virConnectPtr conn, *nparams = ret.params.params_len; /* Deserialise the result. */ - for (i = 0; i < *nparams; ++i) { + for (i = 0; i < *nparams; i++) { if (virStrcpyStatic(params[i].field, ret.params.params_val[i].field) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Stats %s too big for destination"), @@ -1644,7 +1644,7 @@ remoteConnectListDomains(virConnectPtr conn, int *ids, int maxids) goto cleanup; } - for (i = 0; i < ret.ids.ids_len; ++i) + for (i = 0; i < ret.ids.ids_len; i++) ids[i] = ret.ids.ids_val[i]; rv = ret.ids.ids_len; @@ -2032,7 +2032,7 @@ remoteDomainGetVcpuPinInfo(virDomainPtr domain, memset(cpumaps, 0, ncpumaps * maplen); - for (i = 0; i < ret.cpumaps.cpumaps_len; ++i) + for (i = 0; i < ret.cpumaps.cpumaps_len; i++) cpumaps[i] = ret.cpumaps.cpumaps_val[i]; rv = ret.num; @@ -2128,7 +2128,7 @@ remoteDomainGetEmulatorPinInfo(virDomainPtr domain, memset(cpumaps, 0, maplen); - for (i = 0; i < ret.cpumaps.cpumaps_len; ++i) + for (i = 0; i < ret.cpumaps.cpumaps_len; i++) cpumaps[i] = ret.cpumaps.cpumaps_val[i]; rv = ret.ret; @@ -2197,14 +2197,14 @@ remoteDomainGetVcpus(virDomainPtr domain, memset(info, 0, sizeof(virVcpuInfo) * maxinfo); memset(cpumaps, 0, maxinfo * maplen); - for (i = 0; i < ret.info.info_len; ++i) { + for (i = 0; i < ret.info.info_len; i++) { info[i].number = ret.info.info_val[i].number; info[i].state = ret.info.info_val[i].state; info[i].cpuTime = ret.info.info_val[i].cpu_time; info[i].cpu = ret.info.info_val[i].cpu; } - for (i = 0; i < ret.cpumaps.cpumaps_len; ++i) + for (i = 0; i < ret.cpumaps.cpumaps_len; i++) cpumaps[i] = ret.cpumaps.cpumaps_val[i]; rv = ret.info.info_len; diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 9f5bf0e316..27203615ff 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -1940,7 +1940,7 @@ elsif ($mode eq "client") { print " * the documentation). However xdr_free will free up both the\n"; print " * names and the list of pointers, so we have to g_strdup the\n"; print " * names here. */\n"; - print " for (i = 0; i < ret.$single_ret_list_name.${single_ret_list_name}_len; ++i) {\n"; + print " for (i = 0; i < ret.$single_ret_list_name.${single_ret_list_name}_len; i++) {\n"; print " ${single_ret_list_name}[i] = \n"; print " g_strdup(ret.$single_ret_list_name.${single_ret_list_name}_val[i]);\n"; print " }\n"; diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index ffe2f343f9..eb0cd0f9c8 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -355,7 +355,7 @@ virNetClientFindDefaultSshKey(const char *homedir, char **retPath) const char *keys[] = { "identity", "id_dsa", "id_ecdsa", "id_ed25519", "id_rsa" }; - for (i = 0; i < G_N_ELEMENTS(keys); ++i) { + for (i = 0; i < G_N_ELEMENTS(keys); i++) { int ret = virNetClientCheckKeyExists(homedir, keys[i], retPath); if (ret != 0) return ret; diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c index 22d54c99be..19a83d04fe 100644 --- a/src/rpc/virnetlibsshsession.c +++ b/src/rpc/virnetlibsshsession.c @@ -232,7 +232,7 @@ virCredTypeForPrompt(virConnectAuthPtr cred, char echo) { size_t i; - for (i = 0; i < cred->ncredtype; ++i) { + for (i = 0; i < cred->ncredtype; i++) { int type = cred->credtype[i]; if (echo) { if (type == VIR_CRED_ECHOPROMPT) @@ -669,7 +669,7 @@ virNetLibsshAuthenticateKeyboardInteractive(virNetLibsshSession *sess, if (virBufferUse(&buff) > 0) virBufferAddChar(&buff, '\n'); - for (iprompt = 0; iprompt < nprompts; ++iprompt) { + for (iprompt = 0; iprompt < nprompts; iprompt++) { virConnectCredential retr_passphrase; const char *promptStr; int promptStrLen; @@ -900,7 +900,7 @@ virNetLibsshValidateConfig(virNetLibsshSession *sess) size_t i; bool has_auths = false; - for (i = 0; i < sess->nauths; ++i) { + for (i = 0; i < sess->nauths; i++) { if (sess->auths[i]) { has_auths = true; break; diff --git a/src/storage_file/storage_source_backingstore.c b/src/storage_file/storage_source_backingstore.c index e48ae725ab..80cb3ffb05 100644 --- a/src/storage_file/storage_source_backingstore.c +++ b/src/storage_file/storage_source_backingstore.c @@ -220,7 +220,7 @@ virStorageSourceParseRBDColonString(const char *rbdstr, p = options; while (*p) { /* find : delimiter or end of string */ - for (e = p; *e && *e != ':'; ++e) { + for (e = p; *e && *e != ':'; e++) { if (*e == '\\') { e++; if (*e == '\0') @@ -258,7 +258,7 @@ virStorageSourceParseRBDColonString(const char *rbdstr, h = p + strlen("mon_host="); while (h < e) { - for (sep = h; sep < e; ++sep) { + for (sep = h; sep < e; sep++) { if (*sep == '\\' && (sep[1] == ',' || sep[1] == ';' || sep[1] == ' ')) { diff --git a/src/test/test_driver.c b/src/test/test_driver.c index ef0ddab54d..e194e17c1c 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -658,7 +658,7 @@ testDomainGenerateIfname(virDomainDef *domdef) int maxif = 1024; int ifctr; - for (ifctr = 0; ifctr < maxif; ++ifctr) { + for (ifctr = 0; ifctr < maxif; ifctr++) { virDomainNetDef *net = NULL; char *ifname; @@ -1383,7 +1383,7 @@ testConnectAuthenticate(virConnectPtr conn, goto cleanup; /* Does the username exist? */ - for (i = 0; i < privconn->numAuths; ++i) { + for (i = 0; i < privconn->numAuths; i++) { if (STREQ(privconn->auths[i].username, username)) goto found_user; } diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 8e372c3152..af3c5745a9 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -1346,7 +1346,7 @@ virCommandAddEnv(virCommand *cmd, /* Search for the name in the existing environment. */ namelen = strcspn(env, "="); - for (i = 0; i < cmd->nenv; ++i) { + for (i = 0; i < cmd->nenv; i++) { /* + 1 because we want to match the '=' character too. */ if (STREQLEN(cmd->env[i], env, namelen + 1)) { VIR_FREE(cmd->env[i]); diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index aa6a871049..557c3ef693 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -550,7 +550,7 @@ virTypedParamsDeserialize(struct _virTypedParameterRemote *remote_params, *nparams = remote_params_len; /* Deserialize the result. */ - for (i = 0; i < remote_params_len; ++i) { + for (i = 0; i < remote_params_len; i++) { virTypedParameterPtr param = *params + i; struct _virTypedParameterRemote *remote_param = remote_params + i; @@ -657,7 +657,7 @@ virTypedParamsSerialize(virTypedParameterPtr params, params_val = g_new0(struct _virTypedParameterRemote, nparams); - for (i = 0, j = 0; i < nparams; ++i) { + for (i = 0, j = 0; i < nparams; i++) { virTypedParameterPtr param = params + i; struct _virTypedParameterRemote *val = params_val + j; /* NOTE: Following snippet is relevant to server only, because diff --git a/src/util/viruri.c b/src/util/viruri.c index 252e4f598e..a2895259e2 100644 --- a/src/util/viruri.c +++ b/src/util/viruri.c @@ -246,7 +246,7 @@ char *virURIFormatParams(virURI *uri) size_t i; bool amp = false; - for (i = 0; i < uri->paramsCount; ++i) { + for (i = 0; i < uri->paramsCount; i++) { if (!uri->params[i].ignore) { if (amp) virBufferAddChar(&buf, '&'); virBufferStrcat(&buf, uri->params[i].name, "=", NULL); diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c index 2936ff0edb..8bd1d1f84a 100644 --- a/src/vbox/vbox_XPCOMCGlue.c +++ b/src/vbox/vbox_XPCOMCGlue.c @@ -203,7 +203,7 @@ VBoxCGlueInit(unsigned int *version) } /* Try the known locations. */ - for (i = 0; i < G_N_ELEMENTS(knownDirs); ++i) { + for (i = 0; i < G_N_ELEMENTS(knownDirs); i++) { if (tryLoadOne(knownDirs[i], true, true, version) >= 0) return 0; } @@ -303,7 +303,7 @@ vboxArrayRelease(vboxArray *array) if (array->items == NULL) return; - for (i = 0; i < array->count; ++i) { + for (i = 0; i < array->count; i++) { supports = array->items[i]; if (supports != NULL) @@ -328,7 +328,7 @@ vboxArrayUnalloc(vboxArray *array) if (array->items == NULL) return; - for (i = 0; i < array->count; ++i) { + for (i = 0; i < array->count; i++) { item = array->items[i]; if (item != NULL) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 1ca521321c..05ace3a94d 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -720,7 +720,7 @@ static int vboxConnectListDomains(virConnectPtr conn, int *ids, int nids) } ret = 0; - for (i = 0, j = 0; (i < machines.count) && (j < nids); ++i) { + for (i = 0, j = 0; (i < machines.count) && (j < nids); i++) { IMachine *machine = machines.items[i]; if (machine) { @@ -761,7 +761,7 @@ static int vboxConnectNumOfDomains(virConnectPtr conn) } ret = 0; - for (i = 0; i < machines.count; ++i) { + for (i = 0; i < machines.count; i++) { IMachine *machine = machines.items[i]; if (machine) { @@ -880,7 +880,7 @@ virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn, return NULL; } - for (i = 0; i < machines.count; ++i) { + for (i = 0; i < machines.count; i++) { IMachine *machine = machines.items[i]; PRBool isAccessible = PR_FALSE; @@ -952,7 +952,7 @@ vboxDomainLookupByName(virConnectPtr conn, const char *name) return NULL; } - for (i = 0; i < machines.count; ++i) { + for (i = 0; i < machines.count; i++) { IMachine *machine = machines.items[i]; PRBool isAccessible = PR_FALSE; @@ -2245,7 +2245,7 @@ static int vboxDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) return -1; } - for (i = 0; i < machines.count; ++i) { + for (i = 0; i < machines.count; i++) { IMachine *machine = machines.items[i]; PRBool isAccessible = PR_FALSE; @@ -2346,7 +2346,7 @@ static int vboxDomainIsActive(virDomainPtr dom) return ret; } - for (i = 0; i < machines.count; ++i) { + for (i = 0; i < machines.count; i++) { IMachine *machine = machines.items[i]; PRBool isAccessible = PR_FALSE; @@ -2790,7 +2790,7 @@ static int vboxDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) } info->nrVirtCpu = 0; - for (i = 0; i < machines.count; ++i) { + for (i = 0; i < machines.count; i++) { IMachine *machine = machines.items[i]; PRBool isAccessible = PR_FALSE; @@ -4214,7 +4214,7 @@ static int vboxConnectNumOfDefinedDomains(virConnectPtr conn) } ret = 0; - for (i = 0; i < machines.count; ++i) { + for (i = 0; i < machines.count; i++) { PRBool isAccessible = PR_FALSE; IMachine *machine = machines.items[i]; @@ -5822,9 +5822,9 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef *def, _("cannot get snapshot ids")); goto cleanup; } - for (j = 0; j < children.count; ++j) { + for (j = 0; j < children.count; j++) { IMedium *child = children.items[j]; - for (k = 0; k < snapshotIids.count; ++k) { + for (k = 0; k < snapshotIids.count; k++) { PRUnichar *diskSnapId = snapshotIids.items[k]; char *diskSnapIdStr = NULL; VBOX_UTF16_TO_UTF8(diskSnapId, &diskSnapIdStr); @@ -7660,7 +7660,7 @@ vboxDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags) return ret; } - for (i = 0; i < machines.count; ++i) { + for (i = 0; i < machines.count; i++) { IMachine *machine = machines.items[i]; PRBool isAccessible = PR_FALSE; diff --git a/src/vbox/vbox_storage.c b/src/vbox/vbox_storage.c index 10eb35c654..0790e0a741 100644 --- a/src/vbox/vbox_storage.c +++ b/src/vbox/vbox_storage.c @@ -105,7 +105,7 @@ static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool) return -1; } - for (i = 0; i < hardDisks.count; ++i) { + for (i = 0; i < hardDisks.count; i++) { IMedium *hardDisk = hardDisks.items[i]; PRUint32 hddstate; @@ -143,7 +143,7 @@ vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, int nname return -1; } - for (i = 0; i < hardDisks.count && numActive < nnames; ++i) { + for (i = 0; i < hardDisks.count && numActive < nnames; i++) { IMedium *hardDisk = hardDisks.items[i]; PRUint32 hddstate; char *nameUtf8 = NULL; @@ -195,7 +195,7 @@ vboxStorageVolLookupByName(virStoragePoolPtr pool, const char *name) if (NS_FAILED(rc)) return ret; - for (i = 0; i < hardDisks.count; ++i) { + for (i = 0; i < hardDisks.count; i++) { IMedium *hardDisk = hardDisks.items[i]; PRUint32 hddstate; char *nameUtf8 = NULL; diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index af4461f2cb..b482c401ff 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -386,7 +386,7 @@ vmwareVmxPath(virDomainDef *vmdef, char **vmxPath) goto cleanup; } - for (i = 0; i < vmdef->ndisks; ++i) { + for (i = 0; i < vmdef->ndisks; i++) { if (vmdef->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK && virDomainDiskGetType(vmdef->disks[i]) == VIR_STORAGE_TYPE_FILE) { disk = vmdef->disks[i]; diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 1cd5a82227..1ede422239 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1164,7 +1164,7 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDef *def, copy = g_strdup(driver); tmp = copy; - for (; *tmp != '\0'; ++tmp) + for (; *tmp != '\0'; tmp++) *tmp = g_ascii_tolower(*tmp); model = virDomainControllerModelSCSITypeFromString(copy); @@ -1176,7 +1176,7 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDef *def, return -1; } - for (i = 0; i < def->ncontrollers; ++i) { + for (i = 0; i < def->ncontrollers; i++) { if (def->controllers[i]->idx == disk->info.addr.drive.controller) { controller = def->controllers[i]; break; @@ -1220,7 +1220,7 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDef *def, autodetectedModels = g_new0(int, def->ndisks); - for (i = 0; i < def->ncontrollers; ++i) { + for (i = 0; i < def->ncontrollers; i++) { controller = def->controllers[i]; if (controller->type != VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { @@ -1230,7 +1230,7 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDef *def, controllerHasDisksAttached = false; - for (k = 0; k < def->ndisks; ++k) { + for (k = 0; k < def->ndisks; k++) { disk = def->disks[k]; if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI && @@ -1251,7 +1251,7 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDef *def, /* try to autodetect the SCSI controller model by collecting * SCSI controller model of all disks attached to this controller */ - for (k = 0; k < def->ndisks; ++k) { + for (k = 0; k < def->ndisks; k++) { disk = def->disks[k]; if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI && @@ -1268,7 +1268,7 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDef *def, /* autodetection fails when the disks attached to one controller * have inconsistent SCSI controller models */ - for (k = 0; k < count; ++k) { + for (k = 0; k < count; k++) { if (autodetectedModels[k] != autodetectedModels[0]) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Disks on SCSI controller %d have inconsistent " @@ -1690,7 +1690,7 @@ virVMXParseConfig(virVMXContext *ctx, def->ndisks = 0; /* def:disks (scsi) */ - for (controller = 0; controller < 4; ++controller) { + for (controller = 0; controller < 4; controller++) { if (virVMXParseSCSIController(conf, controller, &present, &scsi_virtualDev[controller]) < 0) { goto cleanup; @@ -1699,7 +1699,7 @@ virVMXParseConfig(virVMXContext *ctx, if (! present) continue; - for (unit = 0; unit < 16; ++unit) { + for (unit = 0; unit < 16; unit++) { if (unit == 7) { /* * SCSI unit 7 is assigned to the SCSI controller and cannot be @@ -1744,7 +1744,7 @@ virVMXParseConfig(virVMXContext *ctx, } /* def:disks (sata) */ - for (controller = 0; controller < 4; ++controller) { + for (controller = 0; controller < 4; controller++) { if (virVMXParseSATAController(conf, controller, &present) < 0) { goto cleanup; } @@ -1752,7 +1752,7 @@ virVMXParseConfig(virVMXContext *ctx, if (! present) continue; - for (unit = 0; unit < 30; ++unit) { + for (unit = 0; unit < 30; unit++) { if (virVMXParseDisk(ctx, xmlopt, conf, VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_BUS_SATA, controller, unit, &def->disks[def->ndisks], def) < 0) { @@ -1788,8 +1788,8 @@ virVMXParseConfig(virVMXContext *ctx, } /* def:disks (ide) */ - for (bus = 0; bus < 2; ++bus) { - for (unit = 0; unit < 2; ++unit) { + for (bus = 0; bus < 2; bus++) { + for (unit = 0; unit < 2; unit++) { if (virVMXParseDisk(ctx, xmlopt, conf, VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_BUS_IDE, bus, unit, &def->disks[def->ndisks], def) < 0) { @@ -1813,7 +1813,7 @@ virVMXParseConfig(virVMXContext *ctx, } /* def:disks (floppy) */ - for (unit = 0; unit < 2; ++unit) { + for (unit = 0; unit < 2; unit++) { if (virVMXParseDisk(ctx, xmlopt, conf, VIR_DOMAIN_DISK_DEVICE_FLOPPY, VIR_DOMAIN_DISK_BUS_FDC, 0, unit, &def->disks[def->ndisks], def) < 0) { @@ -1842,7 +1842,7 @@ virVMXParseConfig(virVMXContext *ctx, def->fss = g_new0(virDomainFSDef *, sharedFolder_maxNum); def->nfss = 0; - for (number = 0; number < sharedFolder_maxNum; ++number) { + for (number = 0; number < sharedFolder_maxNum; number++) { if (virVMXParseFileSystem(conf, number, &def->fss[def->nfss]) < 0) { goto cleanup; @@ -1855,7 +1855,7 @@ virVMXParseConfig(virVMXContext *ctx, } /* def:nets */ - for (controller = 0; controller <= results.networks_max_index; ++controller) { + for (controller = 0; controller <= results.networks_max_index; controller++) { virDomainNetDef *net = NULL; if (virVMXParseEthernet(conf, controller, &net) < 0) goto cleanup; @@ -1889,7 +1889,7 @@ virVMXParseConfig(virVMXContext *ctx, def->serials = g_new0(virDomainChrDef *, 4); def->nserials = 0; - for (port = 0; port < 4; ++port) { + for (port = 0; port < 4; port++) { if (virVMXParseSerial(ctx, conf, port, &def->serials[def->nserials]) < 0) { goto cleanup; @@ -1903,7 +1903,7 @@ virVMXParseConfig(virVMXContext *ctx, def->parallels = g_new0(virDomainChrDef *, 3); def->nparallels = 0; - for (port = 0; port < 3; ++port) { + for (port = 0; port < 3; port++) { if (virVMXParseParallel(ctx, conf, port, &def->parallels[def->nparallels]) < 0) { goto cleanup; @@ -2072,7 +2072,7 @@ virVMXParseSCSIController(virConf *conf, int controller, bool *present, if (virtualDev_string != NULL) { tmp = virtualDev_string; - for (; *tmp != '\0'; ++tmp) + for (; *tmp != '\0'; tmp++) *tmp = g_ascii_tolower(*tmp); *virtualDev = virVMXControllerModelSCSITypeFromString(virtualDev_string); @@ -3404,7 +3404,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOption *xmlopt, virDomainDef } /* def:graphics */ - for (i = 0; i < def->ngraphics; ++i) { + for (i = 0; i < def->ngraphics; i++) { switch (def->graphics[i]->type) { case VIR_DOMAIN_GRAPHICS_TYPE_VNC: if (virVMXFormatVNC(def->graphics[i], &buffer) < 0) @@ -3430,7 +3430,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOption *xmlopt, virDomainDef } /* def:disks */ - for (i = 0; i < def->ndisks; ++i) { + for (i = 0; i < def->ndisks; i++) { if (virVMXVerifyDiskAddress(xmlopt, def->disks[i], def) < 0 || virVMXHandleLegacySCSIDiskDriverName(def, def->disks[i]) < 0) { goto cleanup; @@ -3442,7 +3442,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOption *xmlopt, virDomainDef goto cleanup; } - for (i = 0; i < 4; ++i) { + for (i = 0; i < 4; i++) { if (scsi_present[i]) { hasSCSI = true; @@ -3456,7 +3456,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOption *xmlopt, virDomainDef } } - for (i = 0; i < def->ndisks; ++i) { + for (i = 0; i < def->ndisks; i++) { switch (def->disks[i]->device) { case VIR_DOMAIN_DISK_DEVICE_DISK: case VIR_DOMAIN_DISK_DEVICE_CDROM: @@ -3483,7 +3483,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOption *xmlopt, virDomainDef } } - for (i = 0; i < 2; ++i) { + for (i = 0; i < 2; i++) { /* floppy[0..1].present defaults to true, disable it explicitly */ if (! floppy_present[i]) virBufferAsprintf(&buffer, "floppy%zu.present = \"false\"\n", i); @@ -3495,13 +3495,13 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOption *xmlopt, virDomainDef virBufferAsprintf(&buffer, "sharedFolder.maxNum = \"%zu\"\n", def->nfss); } - for (i = 0; i < def->nfss; ++i) { + for (i = 0; i < def->nfss; i++) { if (virVMXFormatFileSystem(def->fss[i], i, &buffer) < 0) goto cleanup; } /* def:nets */ - for (i = 0; i < def->nnets; ++i) { + for (i = 0; i < def->nnets; i++) { if (virVMXFormatEthernet(def->nets[i], i, &buffer, virtualHW_version) < 0) goto cleanup; } @@ -3528,13 +3528,13 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOption *xmlopt, virDomainDef /* FIXME */ /* def:serials */ - for (i = 0; i < def->nserials; ++i) { + for (i = 0; i < def->nserials; i++) { if (virVMXFormatSerial(ctx, def->serials[i], &buffer) < 0) goto cleanup; } /* def:parallels */ - for (i = 0; i < def->nparallels; ++i) { + for (i = 0; i < def->nparallels; i++) { if (virVMXFormatParallel(ctx, def->parallels[i], &buffer) < 0) goto cleanup; } diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index a9cd3d90c9..cf4950df55 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -647,7 +647,7 @@ vzDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) unsigned long long vtime; size_t i; - for (i = 0; i < virDomainDefGetVcpus(dom->def); ++i) { + for (i = 0; i < virDomainDefGetVcpus(dom->def); i++) { if (prlsdkGetVcpuStats(privdom->stats, i, &vtime) < 0) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("cannot read cputime for domain")); diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index e09950812d..9e6bf1ee1a 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -796,7 +796,7 @@ prlsdkAddDomainHardDisksInfo(struct _vzDriver *driver, PRL_HANDLE sdkdom, virDom pret = PrlVmCfg_GetHardDisksCount(sdkdom, &hddCount); prlsdkCheckRetGoto(pret, error); - for (i = 0; i < hddCount; ++i) { + for (i = 0; i < hddCount; i++) { PRL_UINT32 emulatedType; @@ -857,7 +857,7 @@ prlsdkAddDomainOpticalDisksInfo(struct _vzDriver *driver, PRL_HANDLE sdkdom, vir pret = PrlVmCfg_GetOpticalDisksCount(sdkdom, &cdromsCount); prlsdkCheckRetGoto(pret, error); - for (i = 0; i < cdromsCount; ++i) { + for (i = 0; i < cdromsCount; i++) { pret = PrlVmCfg_GetOpticalDisk(sdkdom, i, &cdrom); prlsdkCheckRetGoto(pret, error); @@ -935,7 +935,7 @@ prlsdkGetNetAddresses(PRL_HANDLE sdknet, virDomainNetDef *net) PrlStrList_GetItemsCount(addrlist, &num); prlsdkCheckRetGoto(pret, cleanup); - for (i = 0; i < num; ++i) { + for (i = 0; i < num; i++) { virNetDevIPAddr *ip = NULL; PRL_UINT32 buflen = 0; char *addr; @@ -1120,7 +1120,7 @@ prlsdkAddDomainNetInfo(PRL_HANDLE sdkdom, virDomainDef *def) ret = PrlVmCfg_GetNetAdaptersCount(sdkdom, &netAdaptersCount); prlsdkCheckRetGoto(ret, error); - for (i = 0; i < netAdaptersCount; ++i) { + for (i = 0; i < netAdaptersCount; i++) { ret = PrlVmCfg_GetNetAdapter(sdkdom, i, &netAdapter); prlsdkCheckRetGoto(ret, error); @@ -1235,7 +1235,7 @@ prlsdkAddSerialInfo(PRL_HANDLE sdkdom, ret = PrlVmCfg_GetSerialPortsCount(sdkdom, &serialPortsCount); prlsdkCheckRetGoto(ret, cleanup); - for (i = 0; i < serialPortsCount; ++i) { + for (i = 0; i < serialPortsCount; i++) { ret = PrlVmCfg_GetSerialPort(sdkdom, i, &serialPort); prlsdkCheckRetGoto(ret, cleanup); @@ -1524,7 +1524,7 @@ prlsdkGetDevByDevIndex(PRL_HANDLE sdkdom, PRL_DEVICE_TYPE type, PRL_UINT32 devIn pret = PrlVmCfg_GetDevsCountByType(sdkdom, type, &num); prlsdkCheckRetGoto(pret, error); - for (i = 0; i < num; ++i) { + for (i = 0; i < num; i++) { pret = PrlVmCfg_GetDevByType(sdkdom, type, i, &dev); prlsdkCheckRetGoto(pret, error); @@ -1551,7 +1551,7 @@ virFindDiskBootIndex(virDomainDef *def, virDomainDiskDevice type, int index) size_t i; int c = 0; - for (i = 0; i < def->ndisks; ++i) { + for (i = 0; i < def->ndisks; i++) { if (def->disks[i]->device != type) continue; if (c == index) @@ -1584,7 +1584,7 @@ prlsdkInBootList(PRL_HANDLE sdkdom, pret = PrlVmCfg_GetBootDevCount(sdkdom, &bootNum); prlsdkCheckRetExit(pret, false); - for (i = 0; i < bootNum; ++i) { + for (i = 0; i < bootNum; i++) { pret = PrlVmCfg_GetBootDev(sdkdom, i, &bootDev); prlsdkCheckRetGoto(pret, cleanup); @@ -1722,7 +1722,7 @@ prlsdkConvertBootOrderVm(PRL_HANDLE sdkdom, virDomainDef *def) VIR_WARN("Too many boot devices"); } - for (i = 0; i < bootNum; ++i) { + for (i = 0; i < bootNum; i++) { pret = PrlVmCfg_GetBootDev(sdkdom, i, &bootDev); prlsdkCheckRetGoto(pret, cleanup); @@ -3374,7 +3374,7 @@ prlsdkFindNetByMAC(PRL_HANDLE sdkdom, virMacAddr *mac) pret = PrlVmCfg_GetNetAdaptersCount(sdkdom, &adaptersCount); prlsdkCheckRetGoto(pret, cleanup); - for (i = 0; i < adaptersCount; ++i) { + for (i = 0; i < adaptersCount; i++) { pret = PrlVmCfg_GetNetAdapter(sdkdom, i, &adapter); prlsdkCheckRetGoto(pret, cleanup); @@ -3520,7 +3520,7 @@ prlsdkGetDisk(PRL_HANDLE sdkdom, virDomainDiskDef *disk) pret = PrlVmCfg_GetDevsCountByType(sdkdom, devType, &num); prlsdkCheckRetGoto(pret, error); - for (i = 0; i < num; ++i) { + for (i = 0; i < num; i++) { pret = PrlVmCfg_GetDevByType(sdkdom, devType, i, &sdkdisk); prlsdkCheckRetGoto(pret, error); @@ -3822,7 +3822,7 @@ prlsdkSetBootOrderVm(PRL_HANDLE sdkdom, virDomainDef *def) int sdkType; virDomainBootOrder virType; - for (i = 0; i < def->os.nBootDevs; ++i) { + for (i = 0; i < def->os.nBootDevs; i++) { virType = def->os.bootDevs[i]; switch ((int)virType) { @@ -4198,7 +4198,7 @@ prlsdkDetachDomainHardDisks(virDomainObj *dom) pret = PrlVmCfg_GetHardDisksCount(sdkdom, &hddCount); prlsdkCheckRetGoto(pret, cleanup); - for (i = 0; i < hddCount; ++i) { + for (i = 0; i < hddCount; i++) { pret = PrlVmCfg_GetHardDisk(sdkdom, 0, &sdkdisk); prlsdkCheckRetGoto(pret, cleanup); @@ -4394,7 +4394,7 @@ prlsdkFindNetByPath(PRL_HANDLE sdkdom, const char *path) pret = PrlVmCfg_GetNetAdaptersCount(sdkdom, &count); prlsdkCheckRetGoto(pret, error); - for (i = 0; i < count; ++i) { + for (i = 0; i < count; i++) { pret = PrlVmCfg_GetNetAdapter(sdkdom, i, &net); prlsdkCheckRetGoto(pret, error); diff --git a/tests/esxutilstest.c b/tests/esxutilstest.c index 2e2020006e..95c3f3db1b 100644 --- a/tests/esxutilstest.c +++ b/tests/esxutilstest.c @@ -41,7 +41,7 @@ testParseDatastorePath(const void *data G_GNUC_UNUSED) char *directoryName = NULL; char *directoryAndFileName = NULL; - for (i = 0; i < G_N_ELEMENTS(paths); ++i) { + for (i = 0; i < G_N_ELEMENTS(paths); i++) { VIR_FREE(datastoreName); VIR_FREE(directoryName); VIR_FREE(directoryAndFileName); @@ -127,7 +127,7 @@ testConvertDateTimeToCalendarTime(const void *data G_GNUC_UNUSED) esxVI_DateTime dateTime; long long calendarTime; - for (i = 0; i < G_N_ELEMENTS(times); ++i) { + for (i = 0; i < G_N_ELEMENTS(times); i++) { dateTime.value = (char *)times[i].dateTime; if (esxVI_DateTime_ConvertToCalendarTime(&dateTime, @@ -177,7 +177,7 @@ testEscapeDatastoreItem(const void *data G_GNUC_UNUSED) size_t i; char *escaped = NULL; - for (i = 0; i < G_N_ELEMENTS(datastoreItems); ++i) { + for (i = 0; i < G_N_ELEMENTS(datastoreItems); i++) { VIR_FREE(escaped); escaped = esxUtil_EscapeDatastoreItem(datastoreItems[i].string); @@ -217,7 +217,7 @@ testConvertWindows1252ToUTF8(const void *data G_GNUC_UNUSED) size_t i; char *utf8 = NULL; - for (i = 0; i < G_N_ELEMENTS(windows1252ToUTF8); ++i) { + for (i = 0; i < G_N_ELEMENTS(windows1252ToUTF8); i++) { VIR_FREE(utf8); utf8 = virVMXConvertToUTF8("Windows-1252", diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c index 136c8011b8..6b4da8de6a 100644 --- a/tests/openvzutilstest.c +++ b/tests/openvzutilstest.c @@ -43,7 +43,7 @@ testReadConfigParam(const void *data G_GNUC_UNUSED) conf = g_strdup_printf("%s/openvzutilstest.conf", abs_srcdir); - for (i = 0; i < G_N_ELEMENTS(configParams); ++i) { + for (i = 0; i < G_N_ELEMENTS(configParams); i++) { if (openvzReadConfigParam(conf, configParams[i].param, &value) != configParams[i].ret) { goto cleanup; diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index be576037e2..a20c467ba2 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -593,7 +593,7 @@ testQemuGetLatestCaps(void) VIR_TEST_VERBOSE(""); - for (i = 0; i < G_N_ELEMENTS(archs); ++i) { + for (i = 0; i < G_N_ELEMENTS(archs); i++) { char *cap = testQemuGetLatestCapsForArch(archs[i], "xml"); if (!cap || virHashAddEntry(capslatest, archs[i], cap) < 0) diff --git a/tests/utiltest.c b/tests/utiltest.c index 2921ae8d8c..e589d61482 100644 --- a/tests/utiltest.c +++ b/tests/utiltest.c @@ -43,7 +43,7 @@ testIndexToDiskName(const void *data G_GNUC_UNUSED) { size_t i; - for (i = 0; i < G_N_ELEMENTS(diskNames); ++i) { + for (i = 0; i < G_N_ELEMENTS(diskNames); i++) { g_autofree char *diskName = NULL; diskName = virIndexToDiskName(i, "sd"); @@ -65,7 +65,7 @@ testDiskNameToIndex(const void *data G_GNUC_UNUSED) size_t i; int idx; - for (i = 0; i < 100000; ++i) { + for (i = 0; i < 100000; i++) { g_autofree char *diskName = NULL; diskName = virIndexToDiskName(i, "sd"); @@ -91,7 +91,7 @@ testDiskNameParse(const void *data G_GNUC_UNUSED) int partition; struct testDiskName *disk = NULL; - for (i = 0; i < G_N_ELEMENTS(diskNamesPart); ++i) { + for (i = 0; i < G_N_ELEMENTS(diskNamesPart); i++) { disk = &diskNamesPart[i]; if (virDiskNameParse(disk->name, &idx, &partition)) return -1; @@ -109,7 +109,7 @@ testDiskNameParse(const void *data G_GNUC_UNUSED) } } - for (i = 0; i < G_N_ELEMENTS(diskNamesInvalid); ++i) { + for (i = 0; i < G_N_ELEMENTS(diskNamesInvalid); i++) { if (!virDiskNameParse(diskNamesInvalid[i], &idx, &partition)) { VIR_TEST_DEBUG("Should Fail [%s]", diskNamesInvalid[i]); return -1; @@ -150,7 +150,7 @@ testParseVersionString(const void *data G_GNUC_UNUSED) size_t i; unsigned long version; - for (i = 0; i < G_N_ELEMENTS(versions); ++i) { + for (i = 0; i < G_N_ELEMENTS(versions); i++) { result = virParseVersionString(versions[i].string, &version, versions[i].allowMissing); @@ -278,7 +278,7 @@ testKernelCmdlineNextParam(const void *data G_GNUC_UNUSED) const char *next; size_t i; - for (i = 0; i < G_N_ELEMENTS(kEntries); ++i) { + for (i = 0; i < G_N_ELEMENTS(kEntries); i++) { g_autofree char * param = NULL; g_autofree char * val = NULL; @@ -343,7 +343,7 @@ testKernelCmdlineMatchParam(const void *data G_GNUC_UNUSED) bool result; size_t i, lenValues; - for (i = 0; i < G_N_ELEMENTS(kMatchEntries); ++i) { + for (i = 0; i < G_N_ELEMENTS(kMatchEntries); i++) { if (kMatchEntries[i].values[0] == NULL) lenValues = 0; else diff --git a/tests/virtypedparamtest.c b/tests/virtypedparamtest.c index 87b47ba86e..5efe87416d 100644 --- a/tests/virtypedparamtest.c +++ b/tests/virtypedparamtest.c @@ -276,7 +276,7 @@ testTypedParamsValidator(void) } }; - for (i = 0; test[i].name; ++i) { + for (i = 0; test[i].name; i++) { if (virTestRun(test[i].name, testTypedParamsValidate, &test[i]) < 0) rv = -1; } -- 2.31.1