mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
Convert 'int i' to 'size_t i' in tools/ files
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>
This commit is contained in:
parent
7a1e691711
commit
111f6f4d73
@ -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;
|
||||
@ -880,7 +881,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 */
|
||||
|
||||
@ -1088,7 +1089,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;
|
||||
|
||||
@ -1380,7 +1381,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++) {
|
||||
@ -1396,7 +1397,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;
|
||||
@ -1702,7 +1703,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;
|
||||
|
@ -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);
|
||||
@ -2937,8 +2937,8 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
|
||||
char *def = NULL;
|
||||
char *source = NULL;
|
||||
char *target = NULL;
|
||||
int vol_i;
|
||||
int tok_i;
|
||||
size_t i;
|
||||
size_t j;
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlXPathContextPtr ctxt = NULL;
|
||||
xmlNodePtr *vol_nodes = NULL;
|
||||
@ -3046,8 +3046,8 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
|
||||
if (nvolumes > 0)
|
||||
vlist = vshCalloc(ctl, nvolumes, sizeof(*vlist));
|
||||
|
||||
for (vol_i = 0; vol_i < nvolumes; vol_i++) {
|
||||
ctxt->node = vol_nodes[vol_i];
|
||||
for (i = 0; i < nvolumes; i++) {
|
||||
ctxt->node = vol_nodes[i];
|
||||
|
||||
/* get volume source and target paths */
|
||||
if (!(target = virXPathString("string(./target/@dev)", ctxt)))
|
||||
@ -3067,12 +3067,12 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
|
||||
/* lookup if volume was selected by user */
|
||||
if (volumes) {
|
||||
volume_tok = NULL;
|
||||
for (tok_i = 0; tok_i < nvolume_tokens; tok_i++) {
|
||||
if (volume_tokens[tok_i] &&
|
||||
(STREQ(volume_tokens[tok_i], target) ||
|
||||
STREQ(volume_tokens[tok_i], source))) {
|
||||
volume_tok = volume_tokens[tok_i];
|
||||
volume_tokens[tok_i] = NULL;
|
||||
for (j = 0; j < nvolume_tokens; j++) {
|
||||
if (volume_tokens[j] &&
|
||||
(STREQ(volume_tokens[j], target) ||
|
||||
STREQ(volume_tokens[j], source))) {
|
||||
volume_tok = volume_tokens[j];
|
||||
volume_tokens[j] = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3095,11 +3095,11 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
|
||||
|
||||
/* print volumes specified by user that were not found in domain definition */
|
||||
if (volumes) {
|
||||
for (tok_i = 0; tok_i < nvolume_tokens; tok_i++) {
|
||||
if (volume_tokens[tok_i]) {
|
||||
for (j = 0; j < nvolume_tokens; j++) {
|
||||
if (volume_tokens[j]) {
|
||||
vshError(ctl, _("Volume '%s' was not found in domain's "
|
||||
"definition.\n"),
|
||||
volume_tokens[tok_i]);
|
||||
volume_tokens[j]);
|
||||
vol_not_found = true;
|
||||
}
|
||||
}
|
||||
@ -3162,12 +3162,12 @@ out:
|
||||
|
||||
/* try to undefine storage volumes associated with this domain, if it's requested */
|
||||
if (nvols) {
|
||||
for (vol_i = 0; vol_i < nvols; vol_i++) {
|
||||
for (i = 0; i < nvols; i++) {
|
||||
if (wipe_storage) {
|
||||
vshPrint(ctl, _("Wiping volume '%s'(%s) ... "),
|
||||
vlist[vol_i].target, vlist[vol_i].source);
|
||||
vlist[i].target, vlist[i].source);
|
||||
fflush(stdout);
|
||||
if (virStorageVolWipe(vlist[vol_i].vol, 0) < 0) {
|
||||
if (virStorageVolWipe(vlist[i].vol, 0) < 0) {
|
||||
vshError(ctl, _("Failed! Volume not removed."));
|
||||
ret = false;
|
||||
continue;
|
||||
@ -3177,23 +3177,23 @@ out:
|
||||
}
|
||||
|
||||
/* delete the volume */
|
||||
if (virStorageVolDelete(vlist[vol_i].vol, 0) < 0) {
|
||||
if (virStorageVolDelete(vlist[i].vol, 0) < 0) {
|
||||
vshError(ctl, _("Failed to remove storage volume '%s'(%s)"),
|
||||
vlist[vol_i].target, vlist[vol_i].source);
|
||||
vlist[i].target, vlist[i].source);
|
||||
ret = false;
|
||||
} else {
|
||||
vshPrint(ctl, _("Volume '%s'(%s) removed.\n"),
|
||||
vlist[vol_i].target, vlist[vol_i].source);
|
||||
vlist[i].target, vlist[i].source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
for (vol_i = 0; vol_i < nvols; vol_i++) {
|
||||
VIR_FREE(vlist[vol_i].source);
|
||||
VIR_FREE(vlist[vol_i].target);
|
||||
if (vlist[vol_i].vol)
|
||||
virStorageVolFree(vlist[vol_i].vol);
|
||||
for (i = 0; i < nvols; i++) {
|
||||
VIR_FREE(vlist[i].source);
|
||||
VIR_FREE(vlist[i].target);
|
||||
if (vlist[i].vol)
|
||||
virStorageVolFree(vlist[i].vol);
|
||||
}
|
||||
VIR_FREE(vlist);
|
||||
|
||||
@ -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;
|
||||
@ -7254,7 +7258,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;
|
||||
@ -7419,7 +7423,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;
|
||||
@ -9507,7 +9511,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;
|
||||
@ -9567,7 +9572,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 &&
|
||||
@ -9652,7 +9657,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) {
|
||||
@ -9670,7 +9675,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) {
|
||||
|
@ -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"));
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -331,7 +331,7 @@ finished:
|
||||
success = true;
|
||||
|
||||
cleanup:
|
||||
for (i = 0; i < nfilters; i++)
|
||||
for (i = 0; nfilters != -1 && i < nfilters; i++)
|
||||
VIR_FREE(names[i]);
|
||||
VIR_FREE(names);
|
||||
|
||||
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -461,9 +461,11 @@ finished:
|
||||
success = true;
|
||||
|
||||
cleanup:
|
||||
for (i = 0; i < nsecrets; i++)
|
||||
VIR_FREE(uuids[i]);
|
||||
VIR_FREE(uuids);
|
||||
if (nsecrets > 0) {
|
||||
for (i = 0; i < nsecrets; i++)
|
||||
VIR_FREE(uuids[i]);
|
||||
VIR_FREE(uuids);
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
vshSecretListFree(list);
|
||||
@ -509,7 +511,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;
|
||||
|
@ -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;
|
||||
@ -1408,7 +1408,7 @@ success:
|
||||
|
||||
cleanup:
|
||||
vshSnapshotListFree(snaplist);
|
||||
if (names)
|
||||
if (names && count > 0)
|
||||
for (i = 0; i < count; i++)
|
||||
VIR_FREE(names[i]);
|
||||
VIR_FREE(names);
|
||||
@ -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;
|
||||
|
@ -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;
|
||||
@ -1273,8 +1273,9 @@ finished:
|
||||
success = true;
|
||||
|
||||
cleanup:
|
||||
for (i = 0; i < nvols; i++)
|
||||
VIR_FREE(names[i]);
|
||||
if (nvols > 0)
|
||||
for (i = 0; i < nvols; i++)
|
||||
VIR_FREE(names[i]);
|
||||
VIR_FREE(names);
|
||||
|
||||
if (!success) {
|
||||
@ -1320,7 +1321,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;
|
||||
|
@ -586,7 +586,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);
|
||||
@ -989,7 +989,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;
|
||||
@ -1009,7 +1009,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++) {
|
||||
@ -1050,7 +1050,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;
|
||||
@ -1085,7 +1085,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)
|
||||
@ -1108,7 +1108,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)
|
||||
@ -2972,7 +2972,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'},
|
||||
|
Loading…
Reference in New Issue
Block a user