On 07/08/2013 04:21 PM, Daniel P. Berrange wrote: > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> > > Convert the type of loop iterators named 'i', 'j', k', > 'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or > 'unsigned int', also santizing 'ii', 'jj', 'kk' to use > the normal 'i', 'j', 'k' naming > > Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> > --- > src/qemu/qemu_agent.c | 9 ++-- > src/qemu/qemu_capabilities.c | 7 +-- > src/qemu/qemu_cgroup.c | 12 ++--- > src/qemu/qemu_command.c | 104 +++++++++++++++++++------------------ > src/qemu/qemu_conf.c | 2 +- > src/qemu/qemu_domain.c | 34 ++++++------ > src/qemu/qemu_driver.c | 120 +++++++++++++++++++++++-------------------- > src/qemu/qemu_hostdev.c | 26 +++++----- > src/qemu/qemu_hotplug.c | 54 ++++++++++--------- > src/qemu/qemu_migration.c | 25 ++++----- > src/qemu/qemu_monitor.c | 13 ++--- > src/qemu/qemu_monitor_json.c | 31 ++++++----- > src/qemu/qemu_monitor_text.c | 6 +-- > src/qemu/qemu_process.c | 48 ++++++++--------- > 14 files changed, 259 insertions(+), 232 deletions(-) > > @@ -2135,13 +2137,13 @@ qemuDomainCleanupRun(virQEMUDriverPtr driver, > virDomainObjPtr vm) > { > qemuDomainObjPrivatePtr priv = vm->privateData; > - int i; > + size_t i; > > VIR_DEBUG("driver=%p, vm=%s", driver, vm->def->name); > > /* run cleanup callbacks in reverse order */ > - for (i = priv->ncleanupCallbacks - 1; i >= 0; i--) { > - if (priv->cleanupCallbacks[i]) > + for (i = 0; i < priv->ncleanupCallbacks; i++) { > + if (priv->cleanupCallbacks[priv->ncleanupCallbacks - (i + 1)]) > priv->cleanupCallbacks[i](driver, vm); > } > This changes the order in which cleanup callbacks are run. > @@ -12227,9 +12232,10 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, > ret = qemuMonitorTransaction(priv->mon, actions); > virJSONValueFree(actions); > if (ret < 0) { > + int idx = i; > /* Transaction failed; undo the changes to vm. */ > bool need_unlink = !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT); > - while (--i >= 0) { > + while (--idx >= 0) { > virDomainDiskDefPtr persistDisk = NULL; > > if (snap->def->disks[i].snapshot == How about while (i-- > 0)? > @@ -4286,7 +4287,7 @@ qemuMigrationPerform(virQEMUDriverPtr driver, > > static int > qemuMigrationVPAssociatePortProfiles(virDomainDefPtr def) { > - int i; > + size_t i; > int last_good_net = -1; > virDomainNetDefPtr net; > Jumping to err_exit with last_good_net = -1 leads to i < -1 comparison. Jan -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list