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

Re: [libvirt] [PATCH 08/32] Convert 'int i' to 'size_t i' in src/storage/ files



On 07/08/2013 10:21 PM, Daniel P. Berrange wrote:
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/storage/storage_backend.c         |  8 ++++----
  src/storage/storage_backend_disk.c    |  6 +++---
  src/storage/storage_backend_fs.c      |  2 +-
  src/storage/storage_backend_iscsi.c   |  2 +-
  src/storage/storage_backend_logical.c | 10 ++++++----
  src/storage/storage_backend_rbd.c     |  4 ++--
  src/storage/storage_driver.c          | 19 +++++++++++--------
  7 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 9a3bcf8..fd42a99 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -640,7 +640,7 @@ virStorageBackendCreateQemuImgOpts(char **opts,
  {
      virBuffer buf = VIR_BUFFER_INITIALIZER;
      bool b;
-    int i;
+    size_t i;
if (backingType)
          virBufferAsprintf(&buf, "backing_fmt=%s,", backingType);
@@ -1077,7 +1077,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];
@@ -1372,7 +1372,7 @@ int
  virStorageBackendDetectBlockVolFormatFD(virStorageVolTargetPtr target,
                                          int fd)
  {
-    int i;
+    size_t i;
      off_t start;
      unsigned char buffer[1024];
      ssize_t bytes;
@@ -1674,7 +1674,7 @@ virStorageBackendRunProgNul(virStoragePoolObjPtr pool,
      FILE *fp = NULL;
      char **v;
      int ret = -1;
-    int i;
+    size_t i;
if (n_columns == 0)
          return -1;

missed int i, j in virStorageBackendRunProgRegex()


diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index d15b3d4..d90d164 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -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];
@@ -341,7 +341,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;
@@ -398,7 +399,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;
@@ -1199,7 +1201,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)); @@ -1249,7 +1252,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;
@@ -1369,7 +1372,7 @@ static virStorageVolPtr
  storageVolLookupByKey(virConnectPtr conn,
                        const char *key) {
      virStorageDriverStatePtr driver = conn->storagePrivateData;
-    unsigned int i;
+    size_t i;
      virStorageVolPtr ret = NULL;
storageDriverLock(driver);
@@ -1408,7 +1411,7 @@ static virStorageVolPtr
  storageVolLookupByPath(virConnectPtr conn,
                         const char *path) {
      virStorageDriverStatePtr driver = conn->storagePrivateData;
-    unsigned int i;
+    size_t i;
      virStorageVolPtr ret = NULL;
      char *cleanpath;
@@ -2282,7 +2285,7 @@ storageVolDelete(virStorageVolPtr obj,
      virStoragePoolObjPtr pool;
      virStorageBackendPtr backend;
      virStorageVolDefPtr vol = NULL;
-    unsigned int i;
+    size_t i;
      int ret = -1;
storageDriverLock(driver);

missed storageConnectListStoragePools()
            storageConnectListDefinedStoragePools()
            storagePoolNumOfVolumes()

Guannan


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