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

[libvirt] [PATCH 05/32] Convert 'int i' to 'size_t i' in tools/ 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>
---
 tools/virsh-domain-monitor.c | 17 +++++++++--------
 tools/virsh-domain.c         | 41 +++++++++++++++++++++++------------------
 tools/virsh-host.c           |  8 ++++----
 tools/virsh-interface.c      |  6 +++---
 tools/virsh-network.c        |  6 +++---
 tools/virsh-nodedev.c        |  8 ++++----
 tools/virsh-nwfilter.c       |  6 +++---
 tools/virsh-pool.c           |  7 ++++---
 tools/virsh-secret.c         |  6 +++---
 tools/virsh-snapshot.c       | 12 ++++++------
 tools/virsh-volume.c         |  6 +++---
 tools/virsh.c                | 15 ++++++++-------
 12 files changed, 73 insertions(+), 65 deletions(-)

diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 58d6d40..5a36e09 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -323,7 +323,8 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd)
     virDomainPtr dom;
     const char *name;
     struct _virDomainMemoryStat stats[VIR_DOMAIN_MEMORY_STAT_NR];
-    unsigned int nr_stats, i;
+    unsigned int nr_stats;
+    size_t i;
 
     if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
         return false;
@@ -454,7 +455,7 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd)
     xmlXPathContextPtr ctxt = NULL;
     int ndisks;
     xmlNodePtr *disks = NULL;
-    int i;
+    size_t i;
     bool details = false;
 
     if (vshCommandOptBool(cmd, "inactive"))
@@ -564,7 +565,7 @@ cmdDomiflist(vshControl *ctl, const vshCmd *cmd)
     xmlXPathContextPtr ctxt = NULL;
     int ninterfaces;
     xmlNodePtr *interfaces = NULL;
-    int i;
+    size_t i;
 
     if (vshCommandOptBool(cmd, "inactive"))
         flags |= VIR_DOMAIN_XML_INACTIVE;
@@ -882,7 +883,7 @@ cmdDomblkstat(vshControl *ctl, const vshCmd *cmd)
     char *value = NULL;
     const char *field = NULL;
     int rc, nparams = 0;
-    int i = 0;
+    size_t i;
     bool ret = false;
     bool human = vshCommandOptBool(cmd, "human"); /* human readable output */
 
@@ -1090,7 +1091,7 @@ cmdDomBlkError(vshControl *ctl, const vshCmd *cmd)
     virDomainPtr dom;
     virDomainDiskErrorPtr disks = NULL;
     unsigned int ndisks;
-    int i;
+    size_t i;
     int count;
     bool ret = false;
 
@@ -1382,7 +1383,7 @@ typedef struct vshDomainList *vshDomainListPtr;
 static void
 vshDomainListFree(vshDomainListPtr domlist)
 {
-    int i;
+    size_t i;
 
     if (domlist && domlist->domains) {
         for (i = 0; i < domlist->ndomains; i++) {
@@ -1398,7 +1399,7 @@ static vshDomainListPtr
 vshDomainListCollect(vshControl *ctl, unsigned int flags)
 {
     vshDomainListPtr list = vshMalloc(ctl, sizeof(*list));
-    int i;
+    size_t i;
     int ret;
     int *ids = NULL;
     int nids = 0;
@@ -1704,7 +1705,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd)
     bool optTable = vshCommandOptBool(cmd, "table");
     bool optUUID = vshCommandOptBool(cmd, "uuid");
     bool optName = vshCommandOptBool(cmd, "name");
-    int i;
+    size_t i;
     char *title;
     char uuid[VIR_UUID_STRING_BUFLEN];
     int state;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 5257416..be650c2 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1098,7 +1098,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
     int maxparams = 0;
     virTypedParameterPtr params = NULL;
     unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
-    unsigned int i = 0;
+    size_t i;
     int rv = 0;
     bool current = vshCommandOptBool(cmd, "current");
     bool config = vshCommandOptBool(cmd, "config");
@@ -1276,7 +1276,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
     int nparams = 0;
     int maxparams = 0;
     int rv = 0;
-    unsigned int i = 0;
+    size_t i;
     virTypedParameterPtr params = NULL;
     bool ret = false;
     unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
@@ -2350,7 +2350,7 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd)
     bool config;
     bool ret = false;
     unsigned int flags = 0;
-    int i;
+    size_t i;
     xmlDocPtr xml = NULL;
     xmlXPathContextPtr ctxt = NULL;
     xmlXPathObjectPtr obj = NULL;
@@ -2552,7 +2552,7 @@ cmdDomIftune(vshControl *ctl, const vshCmd *cmd)
     bool config = vshCommandOptBool(cmd, "config");
     bool live = vshCommandOptBool(cmd, "live");
     virNetDevBandwidthRate inbound, outbound;
-    int i;
+    size_t i;
 
     VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
     VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
@@ -4020,7 +4020,7 @@ cmdSchedInfoUpdateOne(vshControl *ctl,
 {
     virTypedParameterPtr param;
     int ret = -1;
-    int i;
+    size_t i;
 
     for (i = 0; i < nsrc_params; i++) {
         param = &(src_params[i]);
@@ -4114,7 +4114,8 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
     virTypedParameterPtr updates = NULL;
     int nparams = 0;
     int nupdates = 0;
-    int i, ret;
+    size_t i;
+    int ret;
     bool ret_val = false;
     unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
     bool current = vshCommandOptBool(cmd, "current");
@@ -5530,7 +5531,8 @@ vshParseCPUList(vshControl *ctl, const char *cpulist,
     unsigned char *cpumap = NULL;
     const char *cur;
     bool unuse = false;
-    int i, cpu, lastcpu;
+    int cpu, lastcpu;
+    size_t i;
 
     cpumap = vshCalloc(ctl, cpumaplen, sizeof(*cpumap));
 
@@ -5625,7 +5627,8 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
     unsigned char *cpumap = NULL;
     unsigned char *cpumaps = NULL;
     size_t cpumaplen;
-    int i, maxcpu, ncpus;
+    int maxcpu, ncpus;
+    size_t i;
     bool config = vshCommandOptBool(cmd, "config");
     bool live = vshCommandOptBool(cmd, "live");
     bool current = vshCommandOptBool(cmd, "current");
@@ -5695,7 +5698,7 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
                if (vcpu != -1 && i != vcpu)
                    continue;
 
-               vshPrint(ctl, "%4d: ", i);
+               vshPrint(ctl, "%4zu: ", i);
                ret = vshPrintPinInfo(cpumaps, cpumaplen, maxcpu, i);
                vshPrint(ctl, "\n");
                if (!ret)
@@ -6102,7 +6105,7 @@ cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd)
     xmlXPathContextPtr ctxt = NULL;
     xmlBufferPtr xml_buf = NULL;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
-    int i;
+    size_t i;
 
     if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
         return false;
@@ -6213,7 +6216,8 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
 {
     virDomainPtr dom;
     virTypedParameterPtr params = NULL;
-    int i, j, pos, max_id, cpu = 0, show_count = -1, nparams = 0;
+    int pos, max_id, cpu = 0, show_count = -1, nparams = 0;
+    size_t i, j;
     bool show_total = false, show_per_cpu = false;
     unsigned int flags = 0;
     bool ret = false;
@@ -6286,7 +6290,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
         for (i = 0; i < ncpus; i++) {
             if (params[i * nparams].type == 0) /* this cpu is not in the map */
                 continue;
-            vshPrint(ctl, "CPU%d:\n", cpu + i);
+            vshPrint(ctl, "CPU%zu:\n", cpu + i);
 
             for (j = 0; j < nparams; j++) {
                 pos = i * nparams + j;
@@ -7258,7 +7262,7 @@ cmdMemtune(vshControl *ctl, const vshCmd *cmd)
     long long min_guarantee = 0;
     int nparams = 0;
     int maxparams = 0;
-    unsigned int i = 0;
+    size_t i;
     virTypedParameterPtr params = NULL;
     bool ret = false;
     unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
@@ -7423,7 +7427,7 @@ cmdNumatune(vshControl * ctl, const vshCmd * cmd)
     virDomainPtr dom;
     int nparams = 0;
     int maxparams = 0;
-    unsigned int i = 0;
+    size_t i;
     virTypedParameterPtr params = NULL;
     const char *nodeset = NULL;
     bool ret = false;
@@ -9517,7 +9521,8 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
     const char *mac =NULL, *type = NULL;
     char *doc = NULL;
     char buf[64];
-    int i = 0, diff_mac;
+    int diff_mac;
+    size_t i;
     int ret;
     int functionReturn = false;
     unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
@@ -9577,7 +9582,7 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
     }
 
     /* multiple possibilities, so search for matching mac */
-    for (; i < obj->nodesetval->nodeNr; i++) {
+    for (i = 0; i < obj->nodesetval->nodeNr; i++) {
         cur = obj->nodesetval->nodeTab[i]->children;
         while (cur != NULL) {
             if (cur->type == XML_ELEMENT_NODE &&
@@ -9662,7 +9667,7 @@ vshFindDisk(const char *doc,
     xmlXPathContextPtr ctxt = NULL;
     xmlNodePtr cur = NULL;
     xmlNodePtr ret = NULL;
-    int i = 0;
+    size_t i;
 
     xml = virXMLParseStringCtxt(doc, _("(domain_definition)"), &ctxt);
     if (!xml) {
@@ -9680,7 +9685,7 @@ vshFindDisk(const char *doc,
     }
 
     /* search disk using @path */
-    for (; i < obj->nodesetval->nodeNr; i++) {
+    for (i = 0; i < obj->nodesetval->nodeNr; i++) {
         bool is_supported = true;
 
         if (type == VSH_FIND_DISK_CHANGEABLE) {
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index a75d844..880ae4b 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -104,7 +104,7 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd)
     unsigned long long *nodes_free = NULL;
     bool all = vshCommandOptBool(cmd, "all");
     bool cellno = vshCommandOptBool(cmd, "cellno");
-    int i;
+    size_t i;
     char *cap_xml = NULL;
     xmlDocPtr xml = NULL;
     xmlXPathContextPtr ctxt = NULL;
@@ -297,7 +297,7 @@ static const vshCmdOptDef opts_node_cpustats[] = {
 static bool
 cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd)
 {
-    int i, j;
+    size_t i, j;
     bool flag_utilization = false;
     bool flag_percent = vshCommandOptBool(cmd, "percent");
     int cpuNum = VIR_NODE_CPU_STATS_ALL_CPUS;
@@ -429,7 +429,7 @@ static bool
 cmdNodeMemStats(vshControl *ctl, const vshCmd *cmd)
 {
     int nparams = 0;
-    unsigned int i = 0;
+    size_t i;
     int cellNum = VIR_NODE_MEMORY_STATS_ALL_CELLS;
     virNodeMemoryStatsPtr params = NULL;
     bool ret = false;
@@ -765,7 +765,7 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
     unsigned int value;
     bool ret = false;
     int rc = -1;
-    int i = 0;
+    size_t i;
 
     if ((rc = vshCommandOptUInt(cmd, "shm-pages-to-scan", &value)) < 0) {
         vshError(ctl, "%s", _("invalid shm-pages-to-scan number"));
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index 2bdb215..9fdd36e 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -172,7 +172,7 @@ typedef struct vshInterfaceList *vshInterfaceListPtr;
 static void
 vshInterfaceListFree(vshInterfaceListPtr list)
 {
-    int i;
+    size_t i;
 
     if (list && list->nifaces) {
         for (i = 0; i < list->nifaces; i++) {
@@ -189,7 +189,7 @@ vshInterfaceListCollect(vshControl *ctl,
                         unsigned int flags)
 {
     vshInterfaceListPtr list = vshMalloc(ctl, sizeof(*list));
-    int i;
+    size_t i;
     int ret;
     char **activeNames = NULL;
     char **inactiveNames = NULL;
@@ -349,7 +349,7 @@ cmdInterfaceList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
     bool all = vshCommandOptBool(cmd, "all");
     unsigned int flags = VIR_CONNECT_LIST_INTERFACES_ACTIVE;
     vshInterfaceListPtr list = NULL;
-    int i;
+    size_t i;
 
     if (inactive)
         flags = VIR_CONNECT_LIST_INTERFACES_INACTIVE;
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index a80cbb5..e1baf0b 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -421,7 +421,7 @@ typedef struct vshNetworkList *vshNetworkListPtr;
 static void
 vshNetworkListFree(vshNetworkListPtr list)
 {
-    int i;
+    size_t i;
 
     if (list && list->nnets) {
         for (i = 0; i < list->nnets; i++) {
@@ -438,7 +438,7 @@ vshNetworkListCollect(vshControl *ctl,
                       unsigned int flags)
 {
     vshNetworkListPtr list = vshMalloc(ctl, sizeof(*list));
-    int i;
+    size_t i;
     int ret;
     char **names = NULL;
     virNetworkPtr net;
@@ -658,7 +658,7 @@ static bool
 cmdNetworkList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
 {
     vshNetworkListPtr list = NULL;
-    int i;
+    size_t i;
     bool inactive = vshCommandOptBool(cmd, "inactive");
     bool all = vshCommandOptBool(cmd, "all");
     bool persistent = vshCommandOptBool(cmd, "persistent");
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index b2e948b..2eb1979 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -208,7 +208,7 @@ typedef struct vshNodeDeviceList *vshNodeDeviceListPtr;
 static void
 vshNodeDeviceListFree(vshNodeDeviceListPtr list)
 {
-    int i;
+    size_t i;
 
     if (list && list->ndevices) {
         for (i = 0; i < list->ndevices; i++) {
@@ -227,7 +227,7 @@ vshNodeDeviceListCollect(vshControl *ctl,
                          unsigned int flags)
 {
     vshNodeDeviceListPtr list = vshMalloc(ctl, sizeof(*list));
-    int i;
+    size_t i;
     int ret;
     virNodeDevicePtr device;
     bool success = false;
@@ -314,7 +314,7 @@ fallback:
         /* Check if the device's capability matches with provied
          * capabilities.
          */
-        int j, k;
+        size_t j, k;
         for (j = 0; j < ncaps; j++) {
             for (k = 0; k < ncapnames; k++) {
                 if (STREQ(caps[j], capnames[k])) {
@@ -393,7 +393,7 @@ static bool
 cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
 {
     const char *cap_str = NULL;
-    int i;
+    size_t i;
     bool tree = vshCommandOptBool(cmd, "tree");
     bool ret = true;
     unsigned int flags = 0;
diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c
index c7a259a..b16428d 100644
--- a/tools/virsh-nwfilter.c
+++ b/tools/virsh-nwfilter.c
@@ -240,7 +240,7 @@ typedef struct vshNWFilterList *vshNWFilterListPtr;
 static void
 vshNWFilterListFree(vshNWFilterListPtr list)
 {
-    int i;
+    size_t i;
 
     if (list && list->nfilters) {
         for (i = 0; i < list->nfilters; i++) {
@@ -257,7 +257,7 @@ vshNWFilterListCollect(vshControl *ctl,
                        unsigned int flags)
 {
     vshNWFilterListPtr list = vshMalloc(ctl, sizeof(*list));
-    int i;
+    size_t i;
     int ret;
     virNWFilterPtr filter;
     bool success = false;
@@ -363,7 +363,7 @@ static const vshCmdOptDef opts_nwfilter_list[] = {
 static bool
 cmdNWFilterList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
 {
-    int i;
+    size_t i;
     char uuid[VIR_UUID_STRING_BUFLEN];
     vshNWFilterListPtr list = NULL;
 
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index c5944ae..1622be2 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -691,7 +691,7 @@ typedef struct vshStoragePoolList *vshStoragePoolListPtr;
 static void
 vshStoragePoolListFree(vshStoragePoolListPtr list)
 {
-    int i;
+    size_t i;
 
     if (list && list->pools) {
         for (i = 0; i < list->npools; i++) {
@@ -708,7 +708,7 @@ vshStoragePoolListCollect(vshControl *ctl,
                           unsigned int flags)
 {
     vshStoragePoolListPtr list = vshMalloc(ctl, sizeof(*list));
-    int i;
+    size_t i;
     int ret;
     char **names = NULL;
     virStoragePoolPtr pool;
@@ -943,7 +943,8 @@ static bool
 cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
 {
     virStoragePoolInfo info;
-    int i, ret;
+    int ret;
+    size_t i;
     bool functionReturn = false;
     size_t stringLength = 0, nameStrLength = 0;
     size_t autostartStrLength = 0, persistStrLength = 0;
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index fb10119..ac11e53 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -367,7 +367,7 @@ typedef struct vshSecretList *vshSecretListPtr;
 static void
 vshSecretListFree(vshSecretListPtr list)
 {
-    int i;
+    size_t i;
 
     if (list && list->nsecrets) {
         for (i = 0; i < list->nsecrets; i++) {
@@ -384,7 +384,7 @@ vshSecretListCollect(vshControl *ctl,
                      unsigned int flags)
 {
     vshSecretListPtr list = vshMalloc(ctl, sizeof(*list));
-    int i;
+    size_t i;
     int ret;
     virSecretPtr secret;
     bool success = false;
@@ -509,7 +509,7 @@ static const vshCmdOptDef opts_secret_list[] = {
 static bool
 cmdSecretList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
 {
-    int i;
+    size_t i;
     vshSecretListPtr list = NULL;
     bool ret = false;
     unsigned int flags = 0;
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 7e75772..a315e28 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -233,7 +233,7 @@ vshParseSnapshotMemspec(vshControl *ctl, virBufferPtr buf, const char *str)
     const char *file = NULL;
     char **array = NULL;
     int narray;
-    int i;
+    size_t i;
 
     if (!str)
         return 0;
@@ -278,7 +278,7 @@ vshParseSnapshotDiskspec(vshControl *ctl, virBufferPtr buf, const char *str)
     const char *file = NULL;
     char **array = NULL;
     int narray;
-    int i;
+    size_t i;
 
     narray = vshStringToArray(str, &array);
     if (narray <= 0)
@@ -1056,7 +1056,7 @@ typedef struct vshSnapshotList *vshSnapshotListPtr;
 static void
 vshSnapshotListFree(vshSnapshotListPtr snaplist)
 {
-    int i;
+    size_t i;
 
     if (!snaplist)
         return;
@@ -1095,7 +1095,7 @@ vshSnapshotListCollect(vshControl *ctl, virDomainPtr dom,
                        virDomainSnapshotPtr from,
                        unsigned int orig_flags, bool tree)
 {
-    int i;
+    size_t i;
     char **names = NULL;
     int count = -1;
     bool descendants = false;
@@ -1347,7 +1347,7 @@ vshSnapshotListCollect(vshControl *ctl, virDomainPtr dom,
             changed = remaining = false;
             for (i = 0; i < count; i++) {
                 bool found_parent = false;
-                int j;
+                size_t j;
 
                 if (!names[i] || !snaplist->snaps[i].parent)
                     continue;
@@ -1517,7 +1517,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
     virDomainPtr dom = NULL;
     bool ret = false;
     unsigned int flags = 0;
-    int i;
+    size_t i;
     xmlDocPtr xml = NULL;
     xmlXPathContextPtr ctxt = NULL;
     char *doc = NULL;
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 35fb762..3166542 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -1185,7 +1185,7 @@ typedef struct vshStorageVolList *vshStorageVolListPtr;
 static void
 vshStorageVolListFree(vshStorageVolListPtr list)
 {
-    int i;
+    size_t i;
 
     if (list && list->vols) {
         for (i = 0; i < list->nvols; i++) {
@@ -1203,7 +1203,7 @@ vshStorageVolListCollect(vshControl *ctl,
                          unsigned int flags)
 {
     vshStorageVolListPtr list = vshMalloc(ctl, sizeof(*list));
-    int i;
+    size_t i;
     char **names = NULL;
     virStorageVolPtr vol = NULL;
     bool success = false;
@@ -1320,7 +1320,7 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
     const char *unit;
     double val;
     bool details = vshCommandOptBool(cmd, "details");
-    int i;
+    size_t i;
     int ret;
     bool functionReturn = false;
     int stringLength = 0;
diff --git a/tools/virsh.c b/tools/virsh.c
index af2bb76..63b9911 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -587,7 +587,7 @@ vshTreePrintInternal(vshControl *ctl,
                      bool root,
                      virBufferPtr indent)
 {
-    int i;
+    size_t i;
     int nextlastdev = -1;
     int ret = -1;
     const char *dev = (lookup)(devid, false, opaque);
@@ -990,7 +990,7 @@ static int
 vshCmddefOptParse(const vshCmdDef *cmd, uint32_t *opts_need_arg,
                   uint32_t *opts_required)
 {
-    int i;
+    size_t i;
     bool optional = false;
 
     *opts_need_arg = 0;
@@ -1010,7 +1010,7 @@ vshCmddefOptParse(const vshCmdDef *cmd, uint32_t *opts_need_arg,
             continue;
         }
         if (opt->type == VSH_OT_ALIAS) {
-            int j;
+            size_t j;
             if (opt->flags || !opt->help)
                 return -1; /* alias options are tracked by the original name */
             for (j = i + 1; cmd->opts[j].name; j++) {
@@ -1051,7 +1051,7 @@ static const vshCmdOptDef *
 vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name,
                    uint32_t *opts_seen, int *opt_index)
 {
-    int i;
+    size_t i;
 
     if (STREQ(name, helpopt.name)) {
         return &helpopt;
@@ -1086,7 +1086,7 @@ static const vshCmdOptDef *
 vshCmddefGetData(const vshCmdDef *cmd, uint32_t *opts_need_arg,
                  uint32_t *opts_seen)
 {
-    int i;
+    size_t i;
     const vshCmdOptDef *opt;
 
     if (!*opts_need_arg)
@@ -1109,7 +1109,7 @@ vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd, uint32_t opts_required,
                     uint32_t opts_seen)
 {
     const vshCmdDef *def = cmd->def;
-    int i;
+    size_t i;
 
     opts_required &= ~opts_seen;
     if (!opts_required)
@@ -2973,7 +2973,8 @@ vshAllowedEscapeChar(char c)
 static bool
 vshParseArgv(vshControl *ctl, int argc, char **argv)
 {
-    int arg, len, debug, i;
+    int arg, len, debug;
+    size_t i;
     int longindex = -1;
     struct option opt[] = {
         {"debug", required_argument, NULL, 'd'},
-- 
1.8.1.4


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