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/test/test_driver.c | 50 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 80a84d5..8e8e3f2 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -167,7 +167,7 @@ testBuildCapabilities(virConnectPtr conn) { virCapsPtr caps; virCapsGuestPtr guest; const char *const guest_types[] = { "hvm", "xen" }; - int i; + size_t i; if ((caps = virCapabilitiesNew(VIR_ARCH_I686, 0, 0)) == NULL) goto no_memory; @@ -331,7 +331,8 @@ static int testNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info); static char * testDomainGenerateIfname(virDomainDefPtr domdef) { int maxif = 1024; - int ifctr, i; + int ifctr; + size_t i; for (ifctr = 0; ifctr < maxif; ++ifctr) { char *ifname; @@ -363,7 +364,7 @@ testDomainGenerateIfname(virDomainDefPtr domdef) { static int testDomainGenerateIfnames(virDomainDefPtr domdef) { - int i = 0; + size_t i = 0; for (i = 0; i < domdef->nnets; i++) { char *ifname; @@ -391,7 +392,7 @@ testDomainUpdateVCPU(virConnectPtr conn ATTRIBUTE_UNUSED, testDomainObjPrivatePtr privdata = dom->privateData; virVcpuInfoPtr info = &privdata->vcpu_infos[vcpu]; unsigned char *cpumap = VIR_GET_CPUMAP(privdata->cpumaps, maplen, vcpu); - int j; + size_t j; bool cpu; memset(info, 0, sizeof(virVcpuInfo)); @@ -440,7 +441,8 @@ testDomainUpdateVCPUs(virConnectPtr conn, { testConnPtr privconn = conn->privateData; testDomainObjPrivatePtr privdata = dom->privateData; - int i, ret = -1; + size_t i; + int ret = -1; int cpumaplen, maxcpu; maxcpu = VIR_NODEINFO_MAXCPUS(privconn->nodeInfo); @@ -705,7 +707,8 @@ static int testOpenVolumesForPool(xmlDocPtr xml, virStoragePoolObjPtr pool, int poolidx) { char *vol_xpath; - int i, ret, func_ret = -1; + size_t i; + int ret, func_ret = -1; xmlNodePtr *vols = NULL; virStorageVolDefPtr def = NULL; @@ -778,7 +781,8 @@ error: static int testOpenFromFile(virConnectPtr conn, const char *file) { - int i, ret; + size_t i; + int ret; long l; char *str; xmlDocPtr xml = NULL; @@ -2303,7 +2307,8 @@ static int testDomainGetVcpus(virDomainPtr domain, testConnPtr privconn = domain->conn->privateData; testDomainObjPrivatePtr privdomdata; virDomainObjPtr privdom; - int i, v, maxcpu, hostcpus; + size_t i; + int v, maxcpu, hostcpus; int ret = -1; struct timeval tv; unsigned long long statbase; @@ -2391,7 +2396,8 @@ static int testDomainPinVcpu(virDomainPtr domain, testDomainObjPrivatePtr privdomdata; virDomainObjPtr privdom; unsigned char *privcpumap; - int i, maxcpu, hostcpus, privmaplen; + size_t i; + int maxcpu, hostcpus, privmaplen; int ret = -1; testDriverLock(privconn); @@ -2548,7 +2554,7 @@ static int testNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freemems, int startCell, int maxCells) { testConnPtr privconn = conn->privateData; - int i, j; + size_t i, j; int ret = -1; testDriverLock(privconn); @@ -2879,7 +2885,8 @@ static int testDomainInterfaceStats(virDomainPtr domain, virDomainObjPtr privdom; struct timeval tv; unsigned long long statbase; - int i, found = 0, ret = -1; + size_t i; + int found = 0, ret = -1; testDriverLock(privconn); privdom = virDomainObjListFindByName(privconn->domains, @@ -3467,7 +3474,8 @@ static int testInterfaceClose(virConnectPtr conn) static int testConnectNumOfInterfaces(virConnectPtr conn) { testConnPtr privconn = conn->privateData; - int i, count = 0; + size_t i; + int count = 0; testDriverLock(privconn); for (i = 0; (i < privconn->ifaces.count); i++) { @@ -3512,7 +3520,8 @@ error: static int testConnectNumOfDefinedInterfaces(virConnectPtr conn) { testConnPtr privconn = conn->privateData; - int i, count = 0; + size_t i; + int count = 0; testDriverLock(privconn); for (i = 0; i < privconn->ifaces.count; i++) { @@ -4612,7 +4621,8 @@ testStoragePoolListVolumes(virStoragePoolPtr pool, int maxnames) { testConnPtr privconn = pool->conn->privateData; virStoragePoolObjPtr privpool; - int i = 0, n = 0; + size_t i = 0; + int n = 0; memset(names, 0, maxnames * sizeof(*names)); @@ -4657,7 +4667,7 @@ testStoragePoolListAllVolumes(virStoragePoolPtr obj, unsigned int flags) { testConnPtr privconn = obj->conn->privateData; virStoragePoolObjPtr pool; - int i; + size_t i; virStorageVolPtr *tmp_vols = NULL; virStorageVolPtr vol = NULL; int nvols = 0; @@ -4768,7 +4778,7 @@ static virStorageVolPtr testStorageVolLookupByKey(virConnectPtr conn, const char *key) { testConnPtr privconn = conn->privateData; - unsigned int i; + size_t i; virStorageVolPtr ret = NULL; testDriverLock(privconn); @@ -4803,7 +4813,7 @@ static virStorageVolPtr testStorageVolLookupByPath(virConnectPtr conn, const char *path) { testConnPtr privconn = conn->privateData; - unsigned int i; + size_t i; virStorageVolPtr ret = NULL; testDriverLock(privconn); @@ -5014,7 +5024,7 @@ testStorageVolDelete(virStorageVolPtr vol, testConnPtr privconn = vol->conn->privateData; virStoragePoolObjPtr privpool; virStorageVolDefPtr privvol; - int i; + size_t i; int ret = -1; virCheckFlags(0, -1); @@ -5246,7 +5256,7 @@ testNodeNumOfDevices(virConnectPtr conn, { testConnPtr driver = conn->privateData; int ndevs = 0; - unsigned int i; + size_t i; virCheckFlags(0, -1); @@ -5269,7 +5279,7 @@ testNodeListDevices(virConnectPtr conn, { testConnPtr driver = conn->privateData; int ndevs = 0; - unsigned int i; + size_t i; virCheckFlags(0, -1); -- 1.8.1.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list