Convert 'int i' to 'size_t i' in src/storage/ files

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@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-07-08 15:09:33 +01:00
parent fb8485d2da
commit bb029fe77f
7 changed files with 36 additions and 28 deletions

View File

@ -636,7 +636,7 @@ virStorageBackendCreateQemuImgOpts(char **opts,
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
bool b;
int i;
size_t i;
if (backingType)
virBufferAsprintf(&buf, "backing_fmt=%s,", backingType);
@ -1069,7 +1069,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];
@ -1362,7 +1362,7 @@ int
virStorageBackendDetectBlockVolFormatFD(virStorageVolTargetPtr target,
int fd)
{
int i;
size_t i;
off_t start;
unsigned char buffer[1024];
ssize_t bytes;
@ -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;
@ -1657,7 +1658,7 @@ virStorageBackendRunProgNul(virStoragePoolObjPtr pool,
FILE *fp = NULL;
char **v;
int ret = -1;
int i;
size_t i;
if (n_columns == 0)
return -1;

View File

@ -432,7 +432,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 ||
@ -454,7 +454,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);
@ -527,7 +527,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;

View File

@ -253,7 +253,7 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSE
};
virStoragePoolSourcePtr source = NULL;
char *retval = NULL;
unsigned int i;
size_t i;
virCommandPtr cmd = NULL;
virCheckFlags(0, NULL);

View File

@ -548,7 +548,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,

View File

@ -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 */
@ -213,7 +214,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;
@ -339,7 +341,7 @@ virStorageBackendLogicalFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTRIBUTE_
virStoragePoolSourceListPtr sourceList = data;
char *pvname = NULL;
char *vgname = NULL;
int i;
size_t i;
virStoragePoolSourceDevicePtr dev;
virStoragePoolSource *thisSource;
@ -402,7 +404,7 @@ virStorageBackendLogicalFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
virCommandPtr cmd;
char *retval = NULL;
virStoragePoolSourceList sourceList;
int i;
size_t i;
virCheckFlags(0, NULL);

View File

@ -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",
@ -260,7 +260,6 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
size_t max_size = 1024;
int ret = -1;
int len = -1;
int 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) {

View File

@ -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];
@ -339,7 +339,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;
@ -363,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;
@ -396,7 +398,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;
@ -420,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;
@ -1158,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);
@ -1197,7 +1202,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));
@ -1247,7 +1253,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;
@ -1365,7 +1371,7 @@ static virStorageVolPtr
storageVolLookupByKey(virConnectPtr conn,
const char *key) {
virStorageDriverStatePtr driver = conn->storagePrivateData;
unsigned int i;
size_t i;
virStorageVolPtr ret = NULL;
storageDriverLock(driver);
@ -1404,7 +1410,7 @@ static virStorageVolPtr
storageVolLookupByPath(virConnectPtr conn,
const char *path) {
virStorageDriverStatePtr driver = conn->storagePrivateData;
unsigned int i;
size_t i;
virStorageVolPtr ret = NULL;
char *cleanpath;
@ -2271,7 +2277,7 @@ storageVolDelete(virStorageVolPtr obj,
virStoragePoolObjPtr pool;
virStorageBackendPtr backend;
virStorageVolDefPtr vol = NULL;
unsigned int i;
size_t i;
int ret = -1;
storageDriverLock(driver);