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

[libvirt] [PATCH 23/32] Convert 'int i' to 'size_t i' in src/locking/ files



From: "Daniel P. Berrange" <berrange redhat com>

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>
---
 src/locking/domain_lock.c         |  6 +++---
 src/locking/lock_driver.h         |  2 +-
 src/locking/lock_driver_lockd.c   |  6 +++---
 src/locking/lock_driver_sanlock.c | 10 +++++-----
 src/locking/lock_manager.c        |  4 ++--
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/locking/domain_lock.c b/src/locking/domain_lock.c
index d79aeac..5e02400 100644
--- a/src/locking/domain_lock.c
+++ b/src/locking/domain_lock.c
@@ -102,7 +102,7 @@ static virLockManagerPtr virDomainLockManagerNew(virLockManagerPluginPtr plugin,
                                                  bool withResources)
 {
     virLockManagerPtr lock;
-    int i;
+    size_t i;
     virLockManagerParam params[] = {
         { .type = VIR_LOCK_MANAGER_PARAM_TYPE_UUID,
           .key = "uuid",
@@ -113,11 +113,11 @@ static virLockManagerPtr virDomainLockManagerNew(virLockManagerPluginPtr plugin,
         },
         { .type = VIR_LOCK_MANAGER_PARAM_TYPE_UINT,
           .key = "id",
-          .value = { .i = dom->def->id },
+          .value = { .iv = dom->def->id },
         },
         { .type = VIR_LOCK_MANAGER_PARAM_TYPE_UINT,
           .key = "pid",
-          .value = { .i = dom->pid },
+          .value = { .iv = dom->pid },
         },
         { .type = VIR_LOCK_MANAGER_PARAM_TYPE_CSTRING,
           .key = "uri",
diff --git a/src/locking/lock_driver.h b/src/locking/lock_driver.h
index c4b162c..a7d9782 100644
--- a/src/locking/lock_driver.h
+++ b/src/locking/lock_driver.h
@@ -80,7 +80,7 @@ struct _virLockManagerParam {
     int type;
     const char *key;
     union {
-        int i;
+        int iv;
         long long l;
         unsigned int ui;
         unsigned long long ul;
diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index cc3b6b1..7c5e6b0 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -466,9 +466,9 @@ static int virLockManagerLockDaemonNew(virLockManagerPtr lock,
                 if (VIR_STRDUP(priv->name, params[i].value.str) < 0)
                     return -1;
             } else if (STREQ(params[i].key, "id")) {
-                priv->id = params[i].value.i;
+                priv->id = params[i].value.iv;
             } else if (STREQ(params[i].key, "pid")) {
-                priv->pid = params[i].value.i;
+                priv->pid = params[i].value.iv;
             } else if (STREQ(params[i].key, "uri")) {
                 /* ignored */
             } else {
@@ -517,7 +517,7 @@ static char *virLockManagerLockDaemonDiskLeaseName(const char *path)
 {
     unsigned char buf[SHA256_DIGEST_SIZE];
     char *ret;
-    int i;
+    size_t i;
 
     if (!(sha256_buffer(path, strlen(path), buf))) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index de14725..33b042d 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -451,7 +451,7 @@ static int virLockManagerSanlockNew(virLockManagerPtr lock,
 {
     virLockManagerParamPtr param;
     virLockManagerSanlockPrivatePtr priv;
-    int i;
+    size_t i;
 
     virCheckFlags(0, -1);
 
@@ -506,7 +506,7 @@ error:
 static void virLockManagerSanlockFree(virLockManagerPtr lock)
 {
     virLockManagerSanlockPrivatePtr priv = lock->privateData;
-    int i;
+    size_t i;
 
     if (!priv)
         return;
@@ -526,7 +526,7 @@ static int virLockManagerSanlockDiskLeaseName(const char *path,
                                               size_t strbuflen)
 {
     unsigned char buf[MD5_DIGEST_SIZE];
-    int i;
+    size_t i;
 
     if (strbuflen < ((MD5_DIGEST_SIZE * 2) + 1)) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -557,7 +557,7 @@ static int virLockManagerSanlockAddLease(virLockManagerPtr lock,
     virLockManagerSanlockPrivatePtr priv = lock->privateData;
     int ret = -1;
     struct sanlk_resource *res = NULL;
-    int i;
+    size_t i;
 
     if (VIR_ALLOC_VAR(res, struct sanlk_disk, 1) < 0) {
         virReportOOMError();
@@ -905,7 +905,7 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock,
     bool res_free = false;
     int sock = -1;
     int rv;
-    int i;
+    size_t i;
 
     virCheckFlags(VIR_LOCK_MANAGER_ACQUIRE_RESTRICT |
                   VIR_LOCK_MANAGER_ACQUIRE_REGISTER_ONLY, -1);
diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c
index 7c30c6f..8ab5efe 100644
--- a/src/locking/lock_manager.c
+++ b/src/locking/lock_manager.c
@@ -77,12 +77,12 @@ virLockManagerSetPluginDir(const char *dir)
 static void virLockManagerLogParams(size_t nparams,
                                     virLockManagerParamPtr params)
 {
-    int i;
+    size_t i;
     char uuidstr[VIR_UUID_STRING_BUFLEN];
     for (i = 0; i < nparams; i++) {
         switch (params[i].type) {
         case VIR_LOCK_MANAGER_PARAM_TYPE_INT:
-            VIR_DEBUG("  key=%s type=int value=%d", params[i].key, params[i].value.i);
+            VIR_DEBUG("  key=%s type=int value=%d", params[i].key, params[i].value.iv);
             break;
         case VIR_LOCK_MANAGER_PARAM_TYPE_UINT:
             VIR_DEBUG("  key=%s type=uint value=%u", params[i].key, params[i].value.ui);
-- 
1.8.1.4


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