On Wed, Jul 10, 2013 at 12:05:25PM +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/test/test_driver.c | 50 ++++++++++++++++++++++++++++++-------------------- > > 1 file changed, 30 insertions(+), 20 deletions(-) > > > > missed testDomainSetSchedulerParametersFlags() > testConnectNumOfNetworks() > testConnectListNetworks() > testConnectNumOfDefinedNetworks() > testConnectListDefinedNetworks() > testConnectListInterfaces() > testConnectListDefinedInterfaces() > testConnectNumOfStoragePools() > testConnectListStoragePools() > testConnectNumOfDefinedStoragePools() > testConnectListDefinedStoragePools() Squashing in diff --git a/src/test/test_driver.c b/src/test/test_driver.c index b1c1917..f7eaf06 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2532,7 +2532,8 @@ static int testNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freemems, int startCell, int maxCells) { testConnPtr privconn = conn->privateData; - size_t i, j; + int cell; + size_t i; int ret = -1; testDriverLock(privconn); @@ -2542,12 +2543,12 @@ static int testNodeGetCellsFreeMemory(virConnectPtr conn, goto cleanup; } - for (i = startCell, j = 0; - (i < privconn->numCells && j < maxCells); - ++i, ++j) { - freemems[j] = privconn->cells[i].mem; + for (cell = startCell, i = 0; + (cell < privconn->numCells && i < maxCells); + ++cell, ++i) { + freemems[i] = privconn->cells[cell].mem; } - ret = j; + ret = i; cleanup: testDriverUnlock(privconn); @@ -2766,7 +2767,8 @@ testDomainSetSchedulerParametersFlags(virDomainPtr domain, { testConnPtr privconn = domain->conn->privateData; virDomainObjPtr privdom; - int ret = -1, i; + int ret = -1; + size_t i; virCheckFlags(0, -1); if (virTypedParamsValidate(params, nparams, @@ -2984,7 +2986,8 @@ cleanup: static int testConnectNumOfNetworks(virConnectPtr conn) { testConnPtr privconn = conn->privateData; - int numActive = 0, i; + int numActive = 0; + size_t i; testDriverLock(privconn); for (i = 0; i < privconn->networks.count; i++) { @@ -3000,7 +3003,8 @@ static int testConnectNumOfNetworks(virConnectPtr conn) { static int testConnectListNetworks(virConnectPtr conn, char **const names, int nnames) { testConnPtr privconn = conn->privateData; - int n = 0, i; + int n = 0; + size_t i; testDriverLock(privconn); memset(names, 0, sizeof(*names)*nnames); @@ -3026,7 +3030,8 @@ error: static int testConnectNumOfDefinedNetworks(virConnectPtr conn) { testConnPtr privconn = conn->privateData; - int numInactive = 0, i; + int numInactive = 0; + size_t i; testDriverLock(privconn); for (i = 0; i < privconn->networks.count; i++) { @@ -3042,7 +3047,8 @@ static int testConnectNumOfDefinedNetworks(virConnectPtr conn) { static int testConnectListDefinedNetworks(virConnectPtr conn, char **const names, int nnames) { testConnPtr privconn = conn->privateData; - int n = 0, i; + int n = 0; + size_t i; testDriverLock(privconn); memset(names, 0, sizeof(*names)*nnames); @@ -3470,7 +3476,8 @@ static int testConnectNumOfInterfaces(virConnectPtr conn) static int testConnectListInterfaces(virConnectPtr conn, char **const names, int nnames) { testConnPtr privconn = conn->privateData; - int n = 0, i; + int n = 0; + size_t i; testDriverLock(privconn); memset(names, 0, sizeof(*names)*nnames); @@ -3516,7 +3523,8 @@ static int testConnectNumOfDefinedInterfaces(virConnectPtr conn) static int testConnectListDefinedInterfaces(virConnectPtr conn, char **const names, int nnames) { testConnPtr privconn = conn->privateData; - int n = 0, i; + int n = 0; + size_t i; testDriverLock(privconn); memset(names, 0, sizeof(*names)*nnames); @@ -3942,7 +3950,8 @@ testStoragePoolLookupByVolume(virStorageVolPtr vol) { static int testConnectNumOfStoragePools(virConnectPtr conn) { testConnPtr privconn = conn->privateData; - int numActive = 0, i; + int numActive = 0; + size_t i; testDriverLock(privconn); for (i = 0; i < privconn->pools.count; i++) @@ -3958,7 +3967,8 @@ testConnectListStoragePools(virConnectPtr conn, char **const names, int nnames) { testConnPtr privconn = conn->privateData; - int n = 0, i; + int n = 0; + size_t i; testDriverLock(privconn); memset(names, 0, sizeof(*names)*nnames); @@ -3985,7 +3995,8 @@ error: static int testConnectNumOfDefinedStoragePools(virConnectPtr conn) { testConnPtr privconn = conn->privateData; - int numInactive = 0, i; + int numInactive = 0; + size_t i; testDriverLock(privconn); for (i = 0; i < privconn->pools.count; i++) { @@ -4004,7 +4015,8 @@ testConnectListDefinedStoragePools(virConnectPtr conn, char **const names, int nnames) { testConnPtr privconn = conn->privateData; - int n = 0, i; + int n = 0; + size_t i; testDriverLock(privconn); memset(names, 0, sizeof(*names)*nnames); 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