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; diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index d0b91f9..5f454f2 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -437,7 +437,7 @@ virStorageBackendDiskPartTypeToCreate(virStoragePoolObjPtr pool) if (pool->def->source.format == VIR_STORAGE_POOL_DISK_DOS) { /* count primary and extended paritions, can't be more than 3 to create a new primary partition */ - int i; + size_t i; int count = 0; for (i = 0; i < pool->volumes.count; i++) { if (pool->volumes.objs[i]->target.type == VIR_STORAGE_VOL_DISK_TYPE_PRIMARY || @@ -459,7 +459,7 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool, virStorageVolDefPtr vol, char** partFormat) { - int i; + size_t i; if (pool->def->source.format == VIR_STORAGE_POOL_DISK_DOS) { const char *partedFormat; partedFormat = virStoragePartedFsTypeTypeToString(vol->target.format); @@ -536,7 +536,7 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool, unsigned long long *end, unsigned long long allocation) { - int i; + size_t i; int smallestExtent = -1; unsigned long long smallestSize = 0; unsigned long long extraBytes = 0; diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 3598d83..906100b 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -257,7 +257,7 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSE }; virStoragePoolSourcePtr source = NULL; char *retval = NULL; - unsigned int i; + size_t i; virCommandPtr cmd = NULL; virCheckFlags(0, NULL); diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c index 0a4cd22..350c42d 100644 --- a/src/storage/storage_backend_iscsi.c +++ b/src/storage/storage_backend_iscsi.c @@ -555,7 +555,7 @@ virStorageBackendISCSIFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED, size_t ntargets = 0; char **targets = NULL; char *ret = NULL; - int i; + size_t i; virStoragePoolSourceList list = { .type = VIR_STORAGE_POOL_ISCSI, .nsources = 0, diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c index 944aa0e..bf2d627 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -77,7 +77,8 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool, regex_t *reg = NULL; regmatch_t *vars = NULL; char *p = NULL; - int i, err, nextents, nvars, ret = -1; + size_t i; + int err, nextents, nvars, ret = -1; const char *attrs = groups[9]; /* Skip inactive volume */ @@ -229,7 +230,8 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool, /* vars[0] is skipped */ for (i = 0; i < nextents; i++) { - int j, len; + size_t j; + int len; char *offset_str = NULL; j = (i * 2) + 1; @@ -355,7 +357,7 @@ virStorageBackendLogicalFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTRIBUTE_ virStoragePoolSourceListPtr sourceList = data; char *pvname = NULL; char *vgname = NULL; - int i; + size_t i; virStoragePoolSourceDevicePtr dev; virStoragePoolSource *thisSource; @@ -420,7 +422,7 @@ virStorageBackendLogicalFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED, virCommandPtr cmd; char *retval = NULL; virStoragePoolSourceList sourceList; - int i; + size_t i; virCheckFlags(0, NULL); diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c index 953a8ee..9d2455c 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -56,7 +56,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr, virBuffer mon_host = VIR_BUFFER_INITIALIZER; virSecretPtr secret = NULL; char secretUuid[VIR_UUID_STRING_BUFLEN]; - int i; + size_t i; char *mon_buff = NULL; VIR_DEBUG("Found Cephx username: %s", @@ -264,7 +264,7 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED, size_t max_size = 1024; int ret = -1; int len = -1; - int i; + size_t i; char *name, *names = NULL; virStorageBackendRBDStatePtr ptr; ptr.cluster = NULL; 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); -- 1.8.1.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list