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

[libvirt] [PATCH 15/32] Convert 'int i' to 'size_t i' in src/remote/ 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/remote/remote_driver.c | 64 ++++++++++++++++++++++++----------------------
 1 file changed, 34 insertions(+), 30 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 7f3e833..6a22393 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -186,7 +186,7 @@ remoteFindDaemonPath(void)
         SBINDIR "/libvirtd_dbg",
         NULL
     };
-    int i;
+    size_t i;
     const char *customDaemon = getenv("LIBVIRTD_PATH");
 
     if (customDaemon)
@@ -517,7 +517,7 @@ doRemoteOpen(virConnectPtr conn,
      * feasibly it might contain variables needed by the real driver,
      * although that won't be the case for now).
      */
-    int i;
+    size_t i;
 
     if (conn->uri) {
         for (i = 0; i < conn->uri->paramsCount; i++) {
@@ -1192,7 +1192,7 @@ remoteNodeGetCPUStats(virConnectPtr conn,
     int rv = -1;
     remote_node_get_cpu_stats_args args;
     remote_node_get_cpu_stats_ret ret;
-    int i = -1;
+    size_t i;
     struct private_data *priv = conn->privateData;
 
     remoteDriverLock(priv);
@@ -1258,7 +1258,7 @@ remoteNodeGetMemoryStats(virConnectPtr conn,
     int rv = -1;
     remote_node_get_memory_stats_args args;
     remote_node_get_memory_stats_ret ret;
-    int i = -1;
+    size_t i;
     struct private_data *priv = conn->privateData;
 
     remoteDriverLock(priv);
@@ -1321,7 +1321,7 @@ remoteNodeGetCellsFreeMemory(virConnectPtr conn,
     int rv = -1;
     remote_node_get_cells_free_memory_args args;
     remote_node_get_cells_free_memory_ret ret;
-    int i;
+    size_t i;
     struct private_data *priv = conn->privateData;
 
     remoteDriverLock(priv);
@@ -1358,7 +1358,7 @@ static int
 remoteConnectListDomains(virConnectPtr conn, int *ids, int maxids)
 {
     int rv = -1;
-    int i;
+    size_t i;
     remote_connect_list_domains_args args;
     remote_connect_list_domains_ret ret;
     struct private_data *priv = conn->privateData;
@@ -1405,7 +1405,7 @@ remoteConnectListAllDomains(virConnectPtr conn,
                             unsigned int flags)
 {
     int rv = -1;
-    int i;
+    size_t i;
     virDomainPtr *doms = NULL;
     remote_connect_list_all_domains_args args;
     remote_connect_list_all_domains_ret ret;
@@ -1467,7 +1467,7 @@ static void
 remoteFreeTypedParameters(remote_typed_param *args_params_val,
                           u_int args_params_len)
 {
-    u_int i;
+    size_t i;
 
     if (args_params_val == NULL)
         return;
@@ -1488,7 +1488,7 @@ remoteSerializeTypedParameters(virTypedParameterPtr params,
                                remote_typed_param **args_params_val,
                                u_int *args_params_len)
 {
-    int i;
+    size_t i;
     int rv = -1;
     remote_typed_param *val;
 
@@ -1551,7 +1551,7 @@ remoteDeserializeTypedParameters(remote_typed_param *ret_params_val,
                                  virTypedParameterPtr *params,
                                  int *nparams)
 {
-    int i = 0;
+    size_t i = 0;
     int rv = -1;
     bool userAllocated = *params != NULL;
 
@@ -1642,8 +1642,8 @@ remoteDeserializeDomainDiskErrors(remote_domain_disk_error *ret_errors_val,
                                   virDomainDiskErrorPtr errors,
                                   int maxerrors)
 {
-    int i = 0;
-    int j;
+    size_t i = 0;
+    size_t j;
 
     if (ret_errors_len > limit || ret_errors_len > maxerrors) {
         virReportError(VIR_ERR_RPC, "%s",
@@ -1881,7 +1881,7 @@ remoteDomainGetVcpuPinInfo(virDomainPtr domain,
                            unsigned int flags)
 {
     int rv = -1;
-    int i;
+    size_t i;
     remote_domain_get_vcpu_pin_info_args args;
     remote_domain_get_vcpu_pin_info_ret ret;
     struct private_data *priv = domain->conn->privateData;
@@ -1992,7 +1992,7 @@ remoteDomainGetEmulatorPinInfo(virDomainPtr domain,
                                unsigned int flags)
 {
     int rv = -1;
-    int i;
+    size_t i;
     remote_domain_get_emulator_pin_info_args args;
     remote_domain_get_emulator_pin_info_ret ret;
     struct private_data *priv = domain->conn->privateData;
@@ -2051,7 +2051,7 @@ remoteDomainGetVcpus(virDomainPtr domain,
                      int maplen)
 {
     int rv = -1;
-    int i;
+    size_t i;
     remote_domain_get_vcpus_args args;
     remote_domain_get_vcpus_ret ret;
     struct private_data *priv = domain->conn->privateData;
@@ -2164,7 +2164,8 @@ remoteDomainGetSecurityLabelList(virDomainPtr domain, virSecurityLabelPtr* secla
     remote_domain_get_security_label_list_args args;
     remote_domain_get_security_label_list_ret ret;
     struct private_data *priv = domain->conn->privateData;
-    int i, rv = -1;
+    size_t i;
+    int rv = -1;
 
     remoteDriverLock(priv);
 
@@ -2498,7 +2499,7 @@ remoteDomainMemoryStats(virDomainPtr domain,
     remote_domain_memory_stats_args args;
     remote_domain_memory_stats_ret ret;
     struct private_data *priv = domain->conn->privateData;
-    unsigned int i;
+    size_t i;
 
     remoteDriverLock(priv);
 
@@ -2826,7 +2827,7 @@ remoteConnectListAllNetworks(virConnectPtr conn,
                              unsigned int flags)
 {
     int rv = -1;
-    int i;
+    size_t i;
     virNetworkPtr *tmp_nets = NULL;
     remote_connect_list_all_networks_args args;
     remote_connect_list_all_networks_ret ret;
@@ -2889,7 +2890,7 @@ remoteConnectListAllInterfaces(virConnectPtr conn,
                                unsigned int flags)
 {
     int rv = -1;
-    int i;
+    size_t i;
     virInterfacePtr *tmp_ifaces = NULL;
     remote_connect_list_all_interfaces_args args;
     remote_connect_list_all_interfaces_ret ret;
@@ -2952,7 +2953,7 @@ remoteConnectListAllNodeDevices(virConnectPtr conn,
                                 unsigned int flags)
 {
     int rv = -1;
-    int i;
+    size_t i;
     virNodeDevicePtr *tmp_devices = NULL;
     remote_connect_list_all_node_devices_args args;
     remote_connect_list_all_node_devices_ret ret;
@@ -3015,7 +3016,7 @@ remoteConnectListAllNWFilters(virConnectPtr conn,
                               unsigned int flags)
 {
     int rv = -1;
-    int i;
+    size_t i;
     virNWFilterPtr *tmp_filters = NULL;
     remote_connect_list_all_nwfilters_args args;
     remote_connect_list_all_nwfilters_ret ret;
@@ -3078,7 +3079,7 @@ remoteConnectListAllSecrets(virConnectPtr conn,
                             unsigned int flags)
 {
     int rv = -1;
-    int i;
+    size_t i;
     virSecretPtr *tmp_secrets = NULL;
     remote_connect_list_all_secrets_args args;
     remote_connect_list_all_secrets_ret ret;
@@ -3279,7 +3280,7 @@ remoteConnectListAllStoragePools(virConnectPtr conn,
                                  unsigned int flags)
 {
     int rv = -1;
-    int i;
+    size_t i;
     virStoragePoolPtr *tmp_pools = NULL;
     remote_connect_list_all_storage_pools_args args;
     remote_connect_list_all_storage_pools_ret ret;
@@ -3342,7 +3343,7 @@ remoteStoragePoolListAllVolumes(virStoragePoolPtr pool,
                                 unsigned int flags)
 {
     int rv = -1;
-    int i;
+    size_t i;
     virStorageVolPtr *tmp_vols = NULL;
     remote_storage_pool_list_all_volumes_args args;
     remote_storage_pool_list_all_volumes_ret ret;
@@ -3566,7 +3567,8 @@ remoteAuthenticate(virConnectPtr conn, struct private_data *priv,
         return 0;
 
     if (authtype) {
-        int want, i;
+        int want;
+        size_t i;
         if (STRCASEEQ(authtype, "sasl") ||
             STRCASEEQLEN(authtype, "sasl.", 5)) {
             want = REMOTE_AUTH_SASL;
@@ -3715,7 +3717,8 @@ static int remoteAuthCredSASL2Vir(int vircred)
 static sasl_callback_t *remoteAuthMakeCallbacks(int *credtype, int ncredtype)
 {
     sasl_callback_t *cbs;
-    int i, n;
+    size_t i;
+    int n;
     if (VIR_ALLOC_N(cbs, ncredtype+1) < 0) {
         return NULL;
     }
@@ -4205,7 +4208,8 @@ remoteAuthPolkit(virConnectPtr conn, struct private_data *priv,
                  virConnectAuthPtr auth)
 {
     remote_auth_polkit_ret ret;
-    int i, allowcb = 0;
+    size_t i;
+    int allowcb = 0;
     virConnectCredential cred = {
         VIR_CRED_EXTERNAL,
         conn->flags & VIR_CONNECT_RO ? "org.libvirt.unix.monitor" : "org.libvirt.unix.manage",
@@ -4500,7 +4504,7 @@ remoteDomainBuildEventGraphics(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
     virDomainEventGraphicsAddressPtr localAddr = NULL;
     virDomainEventGraphicsAddressPtr remoteAddr = NULL;
     virDomainEventGraphicsSubjectPtr subject = NULL;
-    int i;
+    size_t i;
 
     dom = get_nonnull_domain(conn, msg->dom);
     if (!dom)
@@ -5753,7 +5757,7 @@ remoteDomainListAllSnapshots(virDomainPtr dom,
                              unsigned int flags)
 {
     int rv = -1;
-    int i;
+    size_t i;
     virDomainSnapshotPtr *snaps = NULL;
     remote_domain_list_all_snapshots_args args;
     remote_domain_list_all_snapshots_ret ret;
@@ -5816,7 +5820,7 @@ remoteDomainSnapshotListAllChildren(virDomainSnapshotPtr parent,
                                     unsigned int flags)
 {
     int rv = -1;
-    int i;
+    size_t i;
     virDomainSnapshotPtr *snaps = NULL;
     remote_domain_snapshot_list_all_children_args args;
     remote_domain_snapshot_list_all_children_ret ret;
-- 
1.8.1.4


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