[PATCH 01/32] Convert 'int i' to 'size_t i' in daemon/ 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>
---
 daemon/libvirtd-config.c |  5 +++--
 daemon/remote.c          | 55 +++++++++++++++++++++++++-----------------------
 2 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c
index 017d470..e7bbc2e 100644
--- a/daemon/libvirtd-config.c
+++ b/daemon/libvirtd-config.c
@@ -67,7 +67,8 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
         break;
 
     case VIR_CONF_LIST: {
-        int i, len = 0;
+        int len = 0;
+        size_t i;
         virConfValuePtr pp;
         for (pp = p->list; pp; pp = pp->next)
             len++;
@@ -87,7 +88,7 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
                 return -1;
             }
             if (VIR_STRDUP(list[i], pp->str) < 0) {
-                int j;
+                size_t j;
                 for (j = 0; j < i; j++)
                     VIR_FREE(list[j]);
                 VIR_FREE(list);
diff --git a/daemon/remote.c b/daemon/remote.c
index cb362da..6590d1a 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -304,7 +304,7 @@ static int remoteRelayDomainEventGraphics(virConnectPtr conn ATTRIBUTE_UNUSED,
 {
     virNetServerClientPtr client = opaque;
     remote_domain_event_graphics_msg data;
-    int i;
+    size_t i;
 
     if (!client)
         return -1;
@@ -638,11 +638,11 @@ void remoteClientFreeFunc(void *data)
 
     /* Deregister event delivery callback */
     if (priv->conn) {
-        int i;
+        size_t i;
 
         for (i = 0; i < VIR_DOMAIN_EVENT_ID_LAST; i++) {
             if (priv->domainEventCallbackID[i] != -1) {
-                VIR_DEBUG("Deregistering to relay remote events %d", i);
+                VIR_DEBUG("Deregistering to relay remote events %zu", i);
                 virConnectDomainEventDeregisterAny(priv->conn,
                                                    priv->domainEventCallbackID[i]);
             }
@@ -668,7 +668,7 @@ void *remoteClientInitHook(virNetServerClientPtr client,
                            void *opaque ATTRIBUTE_UNUSED)
 {
     struct daemonClientPrivate *priv;
-    int i;
+    size_t i;
 
     if (VIR_ALLOC(priv) < 0) {
         virReportOOMError();
@@ -801,8 +801,8 @@ remoteSerializeTypedParameters(virTypedParameterPtr params,
                                u_int *ret_params_len,
                                unsigned int flags)
 {
-    int i;
-    int j;
+    size_t i;
+    size_t j;
     int rv = -1;
     remote_typed_param *val;
 
@@ -880,7 +880,7 @@ remoteDeserializeTypedParameters(remote_typed_param *args_params_val,
                                  int limit,
                                  int *nparams)
 {
-    int i = 0;
+    size_t i = 0;
     int rv = -1;
     virTypedParameterPtr params = NULL;
 
@@ -1018,7 +1018,7 @@ remoteDispatchConnectListAllDomains(virNetServerPtr server ATTRIBUTE_UNUSED,
 {
     virDomainPtr *doms = NULL;
     int ndomains = 0;
-    int i;
+    size_t i;
     int rv = -1;
     struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
 
@@ -1128,7 +1128,8 @@ remoteDispatchDomainMemoryStats(virNetServerPtr server ATTRIBUTE_UNUSED,
 {
     virDomainPtr dom = NULL;
     struct _virDomainMemoryStat *stats;
-    int nr_stats, i;
+    int nr_stats;
+    size_t i;
     int rv = -1;
     struct daemonClientPrivate *priv =
         virNetServerClientGetPrivateData(client);
@@ -1417,7 +1418,8 @@ remoteDispatchDomainGetSecurityLabelList(virNetServerPtr server ATTRIBUTE_UNUSED
 {
     virDomainPtr dom = NULL;
     virSecurityLabelPtr seclabels = NULL;
-    int i, len, rv = -1;
+    int len, rv = -1;
+    size_t i;
     struct daemonClientPrivate *priv =
         virNetServerClientGetPrivateData(client);
 
@@ -1685,7 +1687,8 @@ remoteDispatchDomainGetVcpus(virNetServerPtr server ATTRIBUTE_UNUSED,
     virDomainPtr dom = NULL;
     virVcpuInfoPtr info = NULL;
     unsigned char *cpumaps = NULL;
-    int info_len, i;
+    int info_len;
+    size_t i;
     int rv = -1;
     struct daemonClientPrivate *priv =
         virNetServerClientGetPrivateData(client);
@@ -2072,7 +2075,7 @@ remoteDispatchNodeGetCPUStats(virNetServerPtr server ATTRIBUTE_UNUSED,
                               remote_node_get_cpu_stats_ret *ret)
 {
     virNodeCPUStatsPtr params = NULL;
-    int i;
+    size_t i;
     int cpuNum = args->cpuNum;
     int nparams = 0;
     unsigned int flags;
@@ -2150,7 +2153,7 @@ remoteDispatchNodeGetMemoryStats(virNetServerPtr server ATTRIBUTE_UNUSED,
                                  remote_node_get_memory_stats_ret *ret)
 {
     virNodeMemoryStatsPtr params = NULL;
-    int i;
+    size_t i;
     int cellNum = args->cellNum;
     int nparams = 0;
     unsigned int flags;
@@ -3887,7 +3890,7 @@ success:
     rv = 0;
     ret->nparams = percpu_len;
     if (args->nparams && !(args->flags & VIR_TYPED_PARAM_STRING_OKAY)) {
-        int i;
+        size_t i;
 
         for (i = 0; i < percpu_len; i++) {
             if (params[i].type == VIR_TYPED_PARAM_STRING)
@@ -3959,7 +3962,7 @@ cleanup:
     if (dom)
         virDomainFree(dom);
     if (errors) {
-        int i;
+        size_t i;
         for (i = 0; i < len; i++)
             VIR_FREE(errors[i].disk);
     }
@@ -3977,7 +3980,7 @@ remoteDispatchDomainListAllSnapshots(virNetServerPtr server ATTRIBUTE_UNUSED,
 {
     virDomainSnapshotPtr *snaps = NULL;
     int nsnaps = 0;
-    int i;
+    size_t i;
     int rv = -1;
     struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
     virDomainPtr dom = NULL;
@@ -4037,7 +4040,7 @@ remoteDispatchDomainSnapshotListAllChildren(virNetServerPtr server ATTRIBUTE_UNU
 {
     virDomainSnapshotPtr *snaps = NULL;
     int nsnaps = 0;
-    int i;
+    size_t i;
     int rv = -1;
     struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
     virDomainPtr dom = NULL;
@@ -4103,7 +4106,7 @@ remoteDispatchConnectListAllStoragePools(virNetServerPtr server ATTRIBUTE_UNUSED
 {
     virStoragePoolPtr *pools = NULL;
     int npools = 0;
-    int i;
+    size_t i;
     int rv = -1;
     struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
 
@@ -4158,7 +4161,7 @@ remoteDispatchStoragePoolListAllVolumes(virNetServerPtr server ATTRIBUTE_UNUSED,
     virStorageVolPtr *vols = NULL;
     virStoragePoolPtr pool = NULL;
     int nvols = 0;
-    int i;
+    size_t i;
     int rv = -1;
     struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
 
@@ -4217,7 +4220,7 @@ remoteDispatchConnectListAllNetworks(virNetServerPtr server ATTRIBUTE_UNUSED,
 {
     virNetworkPtr *nets = NULL;
     int nnets = 0;
-    int i;
+    size_t i;
     int rv = -1;
     struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
 
@@ -4271,7 +4274,7 @@ remoteDispatchConnectListAllInterfaces(virNetServerPtr server ATTRIBUTE_UNUSED,
 {
     virInterfacePtr *ifaces = NULL;
     int nifaces = 0;
-    int i;
+    size_t i;
     int rv = -1;
     struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
 
@@ -4325,7 +4328,7 @@ remoteDispatchConnectListAllNodeDevices(virNetServerPtr server ATTRIBUTE_UNUSED,
 {
     virNodeDevicePtr *devices = NULL;
     int ndevices = 0;
-    int i;
+    size_t i;
     int rv = -1;
     struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
 
@@ -4379,7 +4382,7 @@ remoteDispatchConnectListAllNWFilters(virNetServerPtr server ATTRIBUTE_UNUSED,
 {
     virNWFilterPtr *filters = NULL;
     int nfilters = 0;
-    int i;
+    size_t i;
     int rv = -1;
     struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
 
@@ -4433,7 +4436,7 @@ remoteDispatchConnectListAllSecrets(virNetServerPtr server ATTRIBUTE_UNUSED,
 {
     virSecretPtr *secrets = NULL;
     int nsecrets = 0;
-    int i;
+    size_t i;
     int rv = -1;
     struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
 
@@ -5146,7 +5149,7 @@ remoteSerializeDomainDiskErrors(virDomainDiskErrorPtr errors,
                                 u_int *ret_errors_len)
 {
     remote_domain_disk_error *val = NULL;
-    int i = 0;
+    size_t i = 0;
 
     if (VIR_ALLOC_N(val, nerrors) < 0) {
         virReportOOMError();
@@ -5166,7 +5169,7 @@ remoteSerializeDomainDiskErrors(virDomainDiskErrorPtr errors,
 
 error:
     if (val) {
-        int j;
+        size_t j;
         for (j = 0; j < i; j++)
             VIR_FREE(val[j].disk);
         VIR_FREE(val);
-- 
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]