[PATCH 22/32] Convert 'int i' to 'size_t i' in src/lxc/ files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/lxc/lxc_cgroup.c     |  3 ++-
 src/lxc/lxc_container.c  |  6 ++++--
 src/lxc/lxc_controller.c |  3 ++-
 src/lxc/lxc_driver.c     | 44 ++++++++++++++++++++++----------------------
 src/lxc/lxc_process.c    |  2 +-
 5 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index 4443b83..a96a1f7 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -123,7 +123,8 @@ cleanup:
 static int virLXCCgroupSetupBlkioTune(virDomainDefPtr def,
                                       virCgroupPtr cgroup)
 {
-    int i, rc;
+    size_t i;
+    int rc;
 
     if (def->blkio.weight) {
         rc = virCgroupSetBlkioWeight(cgroup, def->blkio.weight);
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index c8420db..5665c01 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -231,7 +231,8 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomainDefPtr vmDef)
 static int lxcContainerSetStdio(int control, int ttyfd, int handshakefd)
 {
     int rc = -1;
-    int open_max, i;
+    int open_max;
+    size_t i;
 
     if (setsid() < 0) {
         virReportSystemError(errno, "%s",
@@ -712,7 +713,8 @@ static int lxcContainerMountBasicFS(void)
         { SELINUX_MOUNT, SELINUX_MOUNT, NULL, NULL, MS_BIND|MS_REMOUNT|MS_RDONLY },
 #endif
     };
-    int i, rc = -1;
+    size_t i;
+    int rc = -1;
 
     VIR_DEBUG("Mounting basic filesystems");
 
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 88601f1..6077116 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1149,7 +1149,8 @@ virLXCControllerSetupUsernsMap(virDomainIdMapEntryPtr map,
                                char *path)
 {
     virBuffer map_value = VIR_BUFFER_INITIALIZER;
-    int i, ret = -1;
+    size_t i;
+    int ret = -1;
 
     for (i = 0; i < num; i++)
         virBufferAsprintf(&map_value, "%u %u %u\n",
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 1a6d086..71e3dd7 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -815,7 +815,7 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
                              unsigned int flags)
 {
     virLXCDriverPtr driver = dom->conn->privateData;
-    int i;
+    size_t i;
     virDomainObjPtr vm = NULL;
     int ret = -1;
     int rc;
@@ -889,7 +889,7 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
                              unsigned int flags)
 {
     virLXCDriverPtr driver = dom->conn->privateData;
-    int i;
+    size_t i;
     virDomainObjPtr vm = NULL;
     unsigned long long val;
     int ret = -1;
@@ -1846,7 +1846,7 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
                                      unsigned int flags)
 {
     virLXCDriverPtr driver = dom->conn->privateData;
-    int i;
+    size_t i;
     virDomainObjPtr vm = NULL;
     virDomainDefPtr vmdef = NULL;
     int ret = -1;
@@ -2101,7 +2101,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
                             unsigned int flags)
 {
     virLXCDriverPtr driver = dom->conn->privateData;
-    int i;
+    size_t i;
     virDomainObjPtr vm = NULL;
     virDomainDefPtr persistentDef = NULL;
     int ret = -1;
@@ -2200,7 +2200,7 @@ lxcDomainGetBlkioParameters(virDomainPtr dom,
                             unsigned int flags)
 {
     virLXCDriverPtr driver = dom->conn->privateData;
-    int i;
+    size_t i;
     virDomainObjPtr vm = NULL;
     virDomainDefPtr persistentDef = NULL;
     unsigned int val;
@@ -2305,7 +2305,7 @@ lxcDomainInterfaceStats(virDomainPtr dom,
 {
     virLXCDriverPtr driver = dom->conn->privateData;
     virDomainObjPtr vm;
-    int i;
+    size_t i;
     int ret = -1;
 
     lxcDriverLock(driver);
@@ -3879,7 +3879,7 @@ lxcDomainDetachDeviceDiskLive(virDomainObjPtr vm,
 {
     virLXCDomainObjPrivatePtr priv = vm->privateData;
     virDomainDiskDefPtr def = NULL;
-    int i, ret = -1;
+    int idx, ret = -1;
     char *dst = NULL;
 
     if (!priv->initpid) {
@@ -3888,15 +3888,15 @@ lxcDomainDetachDeviceDiskLive(virDomainObjPtr vm,
         goto cleanup;
     }
 
-    if ((i = virDomainDiskIndexByName(vm->def,
-                                      dev->data.disk->dst,
-                                      false)) < 0) {
+    if ((idx = virDomainDiskIndexByName(vm->def,
+                                        dev->data.disk->dst,
+                                        false)) < 0) {
         virReportError(VIR_ERR_OPERATION_FAILED,
                        _("disk %s not found"), dev->data.disk->dst);
         goto cleanup;
     }
 
-    def = vm->def->disks[i];
+    def = vm->def->disks[idx];
 
     if (virAsprintf(&dst, "/proc/%llu/root/dev/%s",
                     (unsigned long long)priv->initpid, def->dst) < 0) {
@@ -3923,7 +3923,7 @@ lxcDomainDetachDeviceDiskLive(virDomainObjPtr vm,
         VIR_WARN("cannot deny device %s for domain %s",
                  def->src, vm->def->name);
 
-    virDomainDiskRemove(vm->def, i);
+    virDomainDiskRemove(vm->def, idx);
     virDomainDiskDefFree(def);
 
     ret = 0;
@@ -4079,7 +4079,7 @@ lxcDomainDetachDeviceHostdevStorageLive(virDomainObjPtr vm,
 {
     virLXCDomainObjPrivatePtr priv = vm->privateData;
     virDomainHostdevDefPtr def = NULL;
-    int i, ret = -1;
+    int idx, ret = -1;
     char *dst = NULL;
 
     if (!priv->initpid) {
@@ -4088,9 +4088,9 @@ lxcDomainDetachDeviceHostdevStorageLive(virDomainObjPtr vm,
         goto cleanup;
     }
 
-    if ((i = virDomainHostdevFind(vm->def,
-                                  dev->data.hostdev,
-                                  &def)) < 0) {
+    if ((idx = virDomainHostdevFind(vm->def,
+                                    dev->data.hostdev,
+                                    &def)) < 0) {
         virReportError(VIR_ERR_OPERATION_FAILED,
                        _("hostdev %s not found"),
                        dev->data.hostdev->source.caps.u.storage.block);
@@ -4123,7 +4123,7 @@ lxcDomainDetachDeviceHostdevStorageLive(virDomainObjPtr vm,
         VIR_WARN("cannot deny device %s for domain %s",
                  def->source.caps.u.storage.block, vm->def->name);
 
-    virDomainHostdevRemove(vm->def, i);
+    virDomainHostdevRemove(vm->def, idx);
     virDomainHostdevDefFree(def);
 
     ret = 0;
@@ -4140,7 +4140,7 @@ lxcDomainDetachDeviceHostdevMiscLive(virDomainObjPtr vm,
 {
     virLXCDomainObjPrivatePtr priv = vm->privateData;
     virDomainHostdevDefPtr def = NULL;
-    int i, ret = -1;
+    int idx, ret = -1;
     char *dst = NULL;
 
     if (!priv->initpid) {
@@ -4149,9 +4149,9 @@ lxcDomainDetachDeviceHostdevMiscLive(virDomainObjPtr vm,
         goto cleanup;
     }
 
-    if ((i = virDomainHostdevFind(vm->def,
-                                  dev->data.hostdev,
-                                  &def)) < 0) {
+    if ((idx = virDomainHostdevFind(vm->def,
+                                    dev->data.hostdev,
+                                    &def)) < 0) {
         virReportError(VIR_ERR_OPERATION_FAILED,
                        _("hostdev %s not found"),
                        dev->data.hostdev->source.caps.u.misc.chardev);
@@ -4184,7 +4184,7 @@ lxcDomainDetachDeviceHostdevMiscLive(virDomainObjPtr vm,
         VIR_WARN("cannot deny device %s for domain %s",
                  def->source.caps.u.misc.chardev, vm->def->name);
 
-    virDomainHostdevRemove(vm->def, i);
+    virDomainHostdevRemove(vm->def, idx);
     virDomainHostdevDefFree(def);
 
     ret = 0;
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 990decb..7f65af2 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -221,7 +221,7 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver,
                                  virDomainObjPtr vm,
                                  virDomainShutoffReason reason)
 {
-    int i;
+    size_t i;
     virLXCDomainObjPrivatePtr priv = vm->privateData;
     virNetDevVPortProfilePtr vport = NULL;
 
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]