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/node_device/node_device_driver.c | 6 +++--- src/node_device/node_device_hal.c | 9 ++++++--- src/nodeinfo.c | 24 ++++++++++++------------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index 1f7e0fd..c7b15e1 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -131,7 +131,7 @@ nodeNumOfDevices(virConnectPtr conn, { virNodeDeviceDriverStatePtr driver = conn->nodeDevicePrivateData; int ndevs = 0; - unsigned int i; + size_t i; if (virNodeNumOfDevicesEnsureACL(conn) < 0) return -1; @@ -161,7 +161,7 @@ nodeListDevices(virConnectPtr conn, { virNodeDeviceDriverStatePtr driver = conn->nodeDevicePrivateData; int ndevs = 0; - unsigned int i; + size_t i; if (virNodeListDevicesEnsureACL(conn) < 0) return -1; @@ -249,7 +249,7 @@ nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn, const char *wwpn, unsigned int flags) { - unsigned int i; + size_t i; virNodeDeviceDriverStatePtr driver = conn->nodeDevicePrivateData; virNodeDeviceObjListPtr devs = &driver->devs; virNodeDevCapsDefPtr cap = NULL; diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c index 794f923..d94767c 100644 --- a/src/node_device/node_device_hal.c +++ b/src/node_device/node_device_hal.c @@ -408,7 +408,8 @@ gather_capabilities(LibHalContext *ctx, const char *udi, char *bus_name = NULL; virNodeDevCapsDefPtr caps = NULL; char **hal_cap_names = NULL; - int rv, i; + int rv; + size_t i; if (STREQ(udi, "/org/freedesktop/Hal/devices/computer")) { rv = gather_capability(ctx, udi, "system", &caps); @@ -632,7 +633,8 @@ nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED, { LibHalContext *hal_ctx = NULL; char **udi = NULL; - int num_devs, i; + int num_devs; + size_t i; int ret = -1; DBusConnection *sysbus; DBusError err; @@ -750,7 +752,8 @@ nodeStateReload(void) { DBusError err; char **udi = NULL; - int num_devs, i; + int num_devs; + size_t i; LibHalContext *hal_ctx; VIR_INFO("Reloading HAL device state"); diff --git a/src/nodeinfo.c b/src/nodeinfo.c index a50f892..d48c7ed 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -157,7 +157,7 @@ virNodeCountThreadSiblings(const char *dir, unsigned int cpu) char *path; FILE *pathfp; char str[1024]; - int i; + size_t i; if (virAsprintf(&path, "%s/cpu%u/topology/thread_siblings", dir, cpu) < 0) { @@ -221,7 +221,7 @@ virNodeParseSocket(const char *dir, unsigned int cpu) static int CPU_COUNT(cpu_set_t *set) { - int i, count = 0; + size_t i, count = 0; for (i = 0; i < CPU_SETSIZE; i++) if (CPU_ISSET(i, set)) @@ -251,7 +251,7 @@ virNodeParseNode(const char *node, int sock; cpu_set_t *core_maps = NULL; int core; - int i; + size_t i; int siblings; unsigned int cpu; int online; @@ -635,7 +635,7 @@ int linuxNodeGetCPUStats(FILE *procstat, char *buf = line; if (STRPREFIX(buf, cpu_header)) { /* aka logical CPU time */ - int i; + size_t i; if (sscanf(buf, "%*s %llu %llu %llu %llu %llu" // user ~ iowait @@ -709,7 +709,7 @@ int linuxNodeGetMemoryStats(FILE *meminfo, int *nparams) { int ret = -1; - int i = 0, j = 0, k = 0; + size_t i = 0, j = 0, k = 0; int found = 0; int nr_param; char line[1024]; @@ -1041,7 +1041,7 @@ nodeGetCPUCount(void) * will be consecutive. */ char *cpupath = NULL; - int i = 0; + size_t i = 0; if (virFileExists(SYSFS_SYSTEM_PATH "/cpu/present")) { i = linuxParseCPUmax(SYSFS_SYSTEM_PATH "/cpu/present"); @@ -1049,7 +1049,7 @@ nodeGetCPUCount(void) do { i++; VIR_FREE(cpupath); - if (virAsprintf(&cpupath, "%s/cpu/cpu%d", + if (virAsprintf(&cpupath, "%s/cpu/cpu%zu", SYSFS_SYSTEM_PATH, i) < 0) { virReportOOMError(); return -1; @@ -1087,7 +1087,7 @@ nodeGetCPUBitmap(int *max_id ATTRIBUTE_UNUSED) if (virFileExists(SYSFS_SYSTEM_PATH "/cpu/online")) { cpumap = linuxParseCPUmap(present, SYSFS_SYSTEM_PATH "/cpu/online"); } else { - int i; + size_t i; cpumap = virBitmapNew(present); if (!cpumap) { @@ -1156,7 +1156,7 @@ nodeMemoryParametersIsAllSupported(virTypedParameterPtr params, int nparams) { char *path = NULL; - int i; + size_t i; for (i = 0; i < nparams; i++) { virTypedParameterPtr param = ¶ms[i]; @@ -1193,7 +1193,7 @@ nodeSetMemoryParameters(virTypedParameterPtr params ATTRIBUTE_UNUSED, virCheckFlags(0, -1); #ifdef __linux__ - int i; + size_t i; int rc; if (virTypedParamsValidate(params, nparams, @@ -1296,7 +1296,7 @@ nodeGetMemoryParameters(virTypedParameterPtr params ATTRIBUTE_UNUSED, unsigned long long pages_unshared; unsigned long long pages_volatile; unsigned long long full_scans = 0; - int i; + size_t i; int ret; if ((*nparams) == 0) { @@ -1638,7 +1638,7 @@ nodeCapsInitNUMA(virCapsPtr caps) memset(allonesmask, 0xff, mask_n_bytes); for (n = 0; n <= numa_max_node(); n++) { - int i; + size_t i; /* The first time this returns -1, ENOENT if node doesn't exist... */ if (numa_node_to_cpus(n, mask, mask_n_bytes) < 0) { VIR_WARN("NUMA topology for cell %d of %d not available, ignoring", -- 1.8.1.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list