On Wed, Jul 10, 2013 at 11:30:14AM +0800, Guannan Ren wrote: > On 07/08/2013 10: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/storage/storage_backend.c | 8 ++++---- > > src/storage/storage_backend_disk.c | 6 +++--- > > src/storage/storage_backend_fs.c | 2 +- > > src/storage/storage_backend_iscsi.c | 2 +- > > src/storage/storage_backend_logical.c | 10 ++++++---- > > src/storage/storage_backend_rbd.c | 4 ++-- > > src/storage/storage_driver.c | 19 +++++++++++-------- > > 7 files changed, 28 insertions(+), 23 deletions(-) > > > >diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c > >index 9a3bcf8..fd42a99 100644 > >--- a/src/storage/storage_backend.c > >+++ b/src/storage/storage_backend.c > >@@ -640,7 +640,7 @@ virStorageBackendCreateQemuImgOpts(char **opts, > > { > > virBuffer buf = VIR_BUFFER_INITIALIZER; > > bool b; > >- int i; > >+ size_t i; > > if (backingType) > > virBufferAsprintf(&buf, "backing_fmt=%s,", backingType); > >@@ -1077,7 +1077,7 @@ virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol, > > virStorageBackendPtr > > virStorageBackendForType(int type) > > { > >- unsigned int i; > >+ size_t i; > > for (i = 0; backends[i]; i++) > > if (backends[i]->type == type) > > return backends[i]; > >@@ -1372,7 +1372,7 @@ int > > virStorageBackendDetectBlockVolFormatFD(virStorageVolTargetPtr target, > > int fd) > > { > >- int i; > >+ size_t i; > > off_t start; > > unsigned char buffer[1024]; > > ssize_t bytes; > >@@ -1674,7 +1674,7 @@ virStorageBackendRunProgNul(virStoragePoolObjPtr pool, > > FILE *fp = NULL; > > char **v; > > int ret = -1; > >- int i; > >+ size_t i; > > if (n_columns == 0) > > return -1; > > missed int i, j in virStorageBackendRunProgRegex() > > > >diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c > >index d15b3d4..d90d164 100644 > >--- a/src/storage/storage_driver.c > >+++ b/src/storage/storage_driver.c > >@@ -67,7 +67,7 @@ static void storageDriverUnlock(virStorageDriverStatePtr driver) > > static void > > storageDriverAutostart(virStorageDriverStatePtr driver) { > >- unsigned int i; > >+ size_t i; > > for (i = 0; i < driver->pools.count; i++) { > > virStoragePoolObjPtr pool = driver->pools.objs[i]; > >@@ -341,7 +341,8 @@ storageClose(virConnectPtr conn) { > > static int > > storageConnectNumOfStoragePools(virConnectPtr conn) { > > virStorageDriverStatePtr driver = conn->storagePrivateData; > >- unsigned int i, nactive = 0; > >+ size_t i; > >+ int nactive = 0; > > if (virConnectNumOfStoragePoolsEnsureACL(conn) < 0) > > return -1; > >@@ -398,7 +399,8 @@ storageConnectListStoragePools(virConnectPtr conn, > > static int > > storageConnectNumOfDefinedStoragePools(virConnectPtr conn) { > > virStorageDriverStatePtr driver = conn->storagePrivateData; > >- unsigned int i, nactive = 0; > >+ size_t i; > >+ int nactive = 0; > > if (virConnectNumOfDefinedStoragePoolsEnsureACL(conn) < 0) > > return -1; > >@@ -1199,7 +1201,8 @@ storagePoolListVolumes(virStoragePoolPtr obj, > > int maxnames) { > > virStorageDriverStatePtr driver = obj->conn->storagePrivateData; > > virStoragePoolObjPtr pool; > >- int i, n = 0; > >+ size_t i; > >+ int n = 0; > > memset(names, 0, maxnames * sizeof(*names)); > >@@ -1249,7 +1252,7 @@ storagePoolListAllVolumes(virStoragePoolPtr pool, > > unsigned int flags) { > > virStorageDriverStatePtr driver = pool->conn->storagePrivateData; > > virStoragePoolObjPtr obj; > >- int i; > >+ size_t i; > > virStorageVolPtr *tmp_vols = NULL; > > virStorageVolPtr vol = NULL; > > int nvols = 0; > >@@ -1369,7 +1372,7 @@ static virStorageVolPtr > > storageVolLookupByKey(virConnectPtr conn, > > const char *key) { > > virStorageDriverStatePtr driver = conn->storagePrivateData; > >- unsigned int i; > >+ size_t i; > > virStorageVolPtr ret = NULL; > > storageDriverLock(driver); > >@@ -1408,7 +1411,7 @@ static virStorageVolPtr > > storageVolLookupByPath(virConnectPtr conn, > > const char *path) { > > virStorageDriverStatePtr driver = conn->storagePrivateData; > >- unsigned int i; > >+ size_t i; > > virStorageVolPtr ret = NULL; > > char *cleanpath; > >@@ -2282,7 +2285,7 @@ storageVolDelete(virStorageVolPtr obj, > > virStoragePoolObjPtr pool; > > virStorageBackendPtr backend; > > virStorageVolDefPtr vol = NULL; > >- unsigned int i; > >+ size_t i; > > int ret = -1; > > storageDriverLock(driver); > > missed storageConnectListStoragePools() > storageConnectListDefinedStoragePools() > storagePoolNumOfVolumes() I'll be squashing this in: diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index f126f4a..5d06eb6 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -1527,7 +1527,8 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool, regex_t *reg; regmatch_t *vars = NULL; char line[1024]; - int maxReg = 0, i, j; + int maxReg = 0; + size_t i, j; int totgroups = 0, ngroup = 0, maxvars = 0; char **groups; diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c index f561106..703d6c4 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -260,7 +260,6 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED, size_t max_size = 1024; int ret = -1; int len = -1; - size_t i; char *name, *names = NULL; virStorageBackendRBDStatePtr ptr; ptr.cluster = NULL; @@ -316,7 +315,7 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED, VIR_FREE(names); } - for (i = 0, name = names; name < names + max_size; i++) { + for (name = names; name < names + max_size; ) { virStorageVolDefPtr vol; if (VIR_REALLOC_N(pool->volumes.objs, pool->volumes.count + 1) < 0) { diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index e27781c..a8eb731 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -364,7 +364,8 @@ storageConnectListStoragePools(virConnectPtr conn, char **const names, int nnames) { virStorageDriverStatePtr driver = conn->storagePrivateData; - int got = 0, i; + int got = 0; + size_t i; if (virConnectListStoragePoolsEnsureACL(conn) < 0) return -1; @@ -422,7 +423,8 @@ storageConnectListDefinedStoragePools(virConnectPtr conn, char **const names, int nnames) { virStorageDriverStatePtr driver = conn->storagePrivateData; - int got = 0, i; + int got = 0; + size_t i; if (virConnectListDefinedStoragePoolsEnsureACL(conn) < 0) return -1; @@ -1160,7 +1162,8 @@ static int storagePoolNumOfVolumes(virStoragePoolPtr obj) { virStorageDriverStatePtr driver = obj->conn->storagePrivateData; virStoragePoolObjPtr pool; - int ret = -1, i; + int ret = -1; + size_t i; storageDriverLock(driver); pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid); Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list