From: "Daniel P. Berrange" <berrange(a)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(a)redhat.com>
---
src/conf/capabilities.c | 32 ++--
src/conf/cpu_conf.c | 18 +--
src/conf/domain_audit.c | 4 +-
src/conf/domain_conf.c | 266 ++++++++++++++++---------------
src/conf/domain_conf.h | 12 +-
src/conf/domain_event.c | 24 +--
src/conf/domain_nwfilter.c | 2 +-
src/conf/interface_conf.c | 73 +++++----
src/conf/netdev_vlan_conf.c | 19 +--
src/conf/network_conf.c | 319 +++++++++++++++++++------------------
src/conf/node_device_conf.c | 27 ++--
src/conf/nwfilter_conf.c | 43 ++---
src/conf/nwfilter_params.c | 26 +--
src/conf/snapshot_conf.c | 21 +--
src/conf/storage_conf.c | 42 ++---
src/conf/storage_encryption_conf.c | 3 +-
16 files changed, 482 insertions(+), 449 deletions(-)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 5aeb2ab..bb5fe4e 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -123,7 +123,7 @@ virCapabilitiesFreeGuestMachine(virCapsGuestMachinePtr machine)
static void
virCapabilitiesFreeGuestDomain(virCapsGuestDomainPtr dom)
{
- int i;
+ size_t i;
if (dom == NULL)
return;
@@ -149,7 +149,7 @@ virCapabilitiesFreeGuestFeature(virCapsGuestFeaturePtr feature)
static void
virCapabilitiesFreeGuest(virCapsGuestPtr guest)
{
- int i;
+ size_t i;
if (guest == NULL)
return;
@@ -175,7 +175,7 @@ virCapabilitiesFreeGuest(virCapsGuestPtr guest)
void
virCapabilitiesFreeNUMAInfo(virCapsPtr caps)
{
- int i;
+ size_t i;
for (i = 0; i < caps->host.nnumaCell; i++)
virCapabilitiesFreeHostNUMACell(caps->host.numaCell[i]);
@@ -187,7 +187,7 @@ static void
virCapabilitiesDispose(void *object)
{
virCapsPtr caps = object;
- int i;
+ size_t i;
for (i = 0; i < caps->nguests; i++)
virCapabilitiesFreeGuest(caps->guests[i]);
@@ -327,7 +327,7 @@ virCapsGuestMachinePtr *
virCapabilitiesAllocMachines(const char *const *names, int nnames)
{
virCapsGuestMachinePtr *machines;
- int i;
+ size_t i;
if (VIR_ALLOC_N(machines, nnames) < 0)
return NULL;
@@ -353,7 +353,7 @@ void
virCapabilitiesFreeMachines(virCapsGuestMachinePtr *machines,
int nmachines)
{
- int i;
+ size_t i;
if (!machines)
return;
for (i = 0; i < nmachines && machines[i]; i++) {
@@ -518,7 +518,7 @@ extern int
virCapabilitiesSupportsGuestArch(virCapsPtr caps,
virArch arch)
{
- int i;
+ size_t i;
for (i = 0; i < caps->nguests; i++) {
if (caps->guests[i]->arch.id == arch)
return 1;
@@ -539,7 +539,7 @@ extern int
virCapabilitiesSupportsGuestOSType(virCapsPtr caps,
const char *ostype)
{
- int i;
+ size_t i;
for (i = 0; i < caps->nguests; i++) {
if (STREQ(caps->guests[i]->ostype, ostype))
return 1;
@@ -562,7 +562,7 @@ virCapabilitiesSupportsGuestOSTypeArch(virCapsPtr caps,
const char *ostype,
virArch arch)
{
- int i;
+ size_t i;
for (i = 0; i < caps->nguests; i++) {
if (STREQ(caps->guests[i]->ostype, ostype) &&
caps->guests[i]->arch.id == arch)
@@ -585,7 +585,7 @@ virCapabilitiesDefaultGuestArch(virCapsPtr caps,
const char *ostype,
const char *domain)
{
- int i, j;
+ size_t i, j;
/* First try to find one matching host arch */
for (i = 0; i < caps->nguests; i++) {
@@ -628,11 +628,11 @@ virCapabilitiesDefaultGuestMachine(virCapsPtr caps,
virArch arch,
const char *domain)
{
- int i;
+ size_t i;
for (i = 0; i < caps->nguests; i++) {
virCapsGuestPtr guest = caps->guests[i];
- int j;
+ size_t j;
if (!STREQ(guest->ostype, ostype) ||
guest->arch.id != arch)
@@ -674,7 +674,7 @@ virCapabilitiesDefaultGuestEmulator(virCapsPtr caps,
virArch arch,
const char *domain)
{
- int i, j;
+ size_t i, j;
for (i = 0; i < caps->nguests; i++) {
char *emulator;
if (STREQ(caps->guests[i]->ostype, ostype) &&
@@ -697,8 +697,8 @@ virCapabilitiesFormatNUMATopology(virBufferPtr xml,
size_t ncells,
virCapsHostNUMACellPtr *cells)
{
- int i;
- int j;
+ size_t i;
+ size_t j;
char *siblings;
virBufferAddLit(xml, " <topology>\n");
@@ -754,7 +754,7 @@ char *
virCapabilitiesFormatXML(virCapsPtr caps)
{
virBuffer xml = VIR_BUFFER_INITIALIZER;
- int i, j, k;
+ size_t i, j, k;
char host_uuid[VIR_UUID_STRING_BUFLEN];
virBufferAddLit(&xml, "<capabilities>\n\n");
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 960d8a6..30a8ba5 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -60,7 +60,7 @@ VIR_ENUM_IMPL(virCPUFeaturePolicy, VIR_CPU_FEATURE_LAST,
void ATTRIBUTE_NONNULL(1)
virCPUDefFreeModel(virCPUDefPtr def)
{
- unsigned int i;
+ size_t i;
VIR_FREE(def->model);
VIR_FREE(def->vendor);
@@ -74,7 +74,7 @@ virCPUDefFreeModel(virCPUDefPtr def)
void
virCPUDefFree(virCPUDefPtr def)
{
- unsigned int i;
+ size_t i;
if (!def)
return;
@@ -97,7 +97,7 @@ virCPUDefCopyModel(virCPUDefPtr dst,
const virCPUDefPtr src,
bool resetPolicy)
{
- unsigned int i;
+ size_t i;
if (VIR_STRDUP(dst->model, src->model) < 0 ||
VIR_STRDUP(dst->vendor, src->vendor) < 0 ||
@@ -133,7 +133,7 @@ virCPUDefPtr
virCPUDefCopy(const virCPUDefPtr cpu)
{
virCPUDefPtr copy;
- unsigned int i;
+ size_t i;
if (!cpu)
return NULL;
@@ -190,7 +190,7 @@ virCPUDefParseXML(const xmlNodePtr node,
virCPUDefPtr def;
xmlNodePtr *nodes = NULL;
int n;
- unsigned int i;
+ size_t i;
char *cpuMode;
char *fallback = NULL;
char *vendor_id = NULL;
@@ -390,7 +390,7 @@ virCPUDefParseXML(const xmlNodePtr node,
for (i = 0; i < n; i++) {
char *name;
int policy; /* enum virDomainCPUFeaturePolicy */
- unsigned int j;
+ size_t j;
if (def->type == VIR_CPU_TYPE_GUEST) {
char *strpolicy;
@@ -576,7 +576,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
virCPUDefPtr def,
unsigned int flags)
{
- unsigned int i;
+ size_t i;
bool formatModel;
bool formatFallback;
@@ -677,7 +677,7 @@ virCPUDefAddFeature(virCPUDefPtr def,
const char *name,
int policy)
{
- int i;
+ size_t i;
for (i = 0; i < def->nfeatures; i++) {
if (STREQ(name, def->features[i].name)) {
@@ -712,7 +712,7 @@ virCPUDefIsEqual(virCPUDefPtr src,
virCPUDefPtr dst)
{
bool identical = false;
- int i;
+ size_t i;
if (!src && !dst)
return true;
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index 97e71f7..949317a 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -793,7 +793,7 @@ virDomainAuditLifecycle(virDomainObjPtr vm, const char *op,
void
virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success)
{
- int i;
+ size_t i;
for (i = 0; i < vm->def->ndisks; i++) {
virDomainDiskDefPtr disk = vm->def->disks[i];
@@ -874,7 +874,7 @@ virDomainAuditSecurityLabel(virDomainObjPtr vm, bool success)
char uuidstr[VIR_UUID_STRING_BUFLEN];
char *vmname;
const char *virt;
- int i;
+ size_t i;
virUUIDFormat(vm->def->uuid, uuidstr);
if (!(vmname = virAuditEncode("vm", vm->def->name))) {
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 402e6e9..b9713e6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -869,7 +869,7 @@ void
virBlkioDeviceWeightArrayClear(virBlkioDeviceWeightPtr deviceWeights,
int ndevices)
{
- int i;
+ size_t i;
for (i = 0; i < ndevices; i++)
VIR_FREE(deviceWeights[i].path);
@@ -1101,7 +1101,7 @@ virSecurityDeviceLabelDefFree(virSecurityDeviceLabelDefPtr def)
void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
{
- int ii;
+ size_t i;
if (!def)
return;
@@ -1131,8 +1131,8 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
break;
}
- for (ii = 0; ii < def->nListens; ii++)
- virDomainGraphicsListenDefClear(&def->listens[ii]);
+ for (i = 0; i < def->nListens; i++)
+ virDomainGraphicsListenDefClear(&def->listens[i]);
VIR_FREE(def->listens);
VIR_FREE(def);
@@ -1173,7 +1173,7 @@ virDomainDiskSourcePoolDefFree(virDomainDiskSourcePoolDefPtr def)
void virDomainDiskDefFree(virDomainDiskDefPtr def)
{
- unsigned int i;
+ size_t i;
if (!def)
return;
@@ -1550,7 +1550,7 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def)
virDomainDeviceInfoClear(&def->info);
- int i;
+ size_t i;
for (i = 0; i < def->ncodecs; i++)
virDomainSoundCodecDefFree(def->codecs[i]);
VIR_FREE(def->codecs);
@@ -1781,7 +1781,7 @@ virDomainClockDefClear(virDomainClockDefPtr def)
if (def->offset == VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE)
VIR_FREE(def->data.timezone);
- int i;
+ size_t i;
for (i = 0; i < def->ntimers; i++)
VIR_FREE(def->timers[i]);
VIR_FREE(def->timers);
@@ -1790,7 +1790,7 @@ virDomainClockDefClear(virDomainClockDefPtr def)
virDomainVcpuPinDefPtr *
virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin)
{
- int i = 0;
+ size_t i;
virDomainVcpuPinDefPtr *ret = NULL;
if (VIR_ALLOC_N(ret, nvcpupin) < 0) {
@@ -1809,7 +1809,7 @@ virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin)
no_memory:
if (ret) {
- for (; i >= 0; --i) {
+ for (i = 0; i < nvcpupin; i++) {
if (ret[i]) {
virBitmapFree(ret[i]->cpumask);
VIR_FREE(ret[i]);
@@ -1835,7 +1835,7 @@ void
virDomainVcpuPinDefArrayFree(virDomainVcpuPinDefPtr *def,
int nvcpupin)
{
- int i;
+ size_t i;
if (!def || !nvcpupin)
return;
@@ -1861,7 +1861,7 @@ virDomainResourceDefFree(virDomainResourceDefPtr resource)
void virDomainDefFree(virDomainDefPtr def)
{
- unsigned int i;
+ size_t i;
if (!def)
return;
@@ -2482,7 +2482,7 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr def,
bool all,
void *opaque)
{
- int i;
+ size_t i;
virDomainDeviceDef device;
device.type = VIR_DOMAIN_DEVICE_DISK;
@@ -2649,7 +2649,7 @@ virDomainDefRejectDuplicateControllers(virDomainDefPtr def)
size_t nbitmaps = 0;
int ret = -1;
bool b;
- int i;
+ size_t i;
memset(max_idx, -1, sizeof(max_idx));
@@ -2701,7 +2701,7 @@ static int
virDomainDefPostParseInternal(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED)
{
- int i;
+ size_t i;
/* verify init path for container based domains */
if (STREQ(def->os.type, "exe") && !def->os.init) {
@@ -3819,7 +3819,7 @@ virDomainDriveAddressIsUsedByDisk(virDomainDefPtr def,
unsigned int unit)
{
virDomainDiskDefPtr disk;
- int i;
+ size_t i;
for (i = 0; i < def->ndisks; i++) {
disk = def->disks[i];
@@ -3848,7 +3848,7 @@ virDomainDriveAddressIsUsedByHostdev(virDomainDefPtr def,
unsigned int unit)
{
virDomainHostdevDefPtr hostdev;
- int i;
+ size_t i;
for (i = 0; i < def->nhostdevs; i++) {
hostdev = def->hostdevs[i];
@@ -3892,7 +3892,7 @@ virDomainControllerSCSINextUnit(virDomainDefPtr def,
unsigned int max_unit,
unsigned int controller)
{
- int i;
+ size_t i;
for (i = 0; i < max_unit; i++) {
if (!virDomainSCSIDriveAddressIsUsed(def, controller, i))
@@ -3912,7 +3912,7 @@ virDomainHostdevAssignAddress(virDomainXMLOptionPtr xmlopt,
{
int next_unit = 0;
unsigned controller = 0;
- int i;
+ size_t i;
int ret;
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI)
@@ -4144,7 +4144,7 @@ virDomainDeviceFindControllerModel(virDomainDefPtr def,
int controllerType)
{
int model = -1;
- int i;
+ size_t i;
for (i = 0; i < def->ncontrollers; i++) {
if (def->controllers[i]->type == controllerType &&
@@ -4160,7 +4160,7 @@ virDomainDiskFindByBusAndDst(virDomainDefPtr def,
int bus,
char *dst)
{
- int i;
+ size_t i;
if (!dst)
return NULL;
@@ -4366,7 +4366,8 @@ virSecurityLabelDefsParseXML(virDomainDefPtr def,
virCapsPtr caps,
unsigned int flags)
{
- int i = 0, n;
+ size_t i = 0;
+ int n;
xmlNodePtr *list = NULL, saved_node;
virCapsHostPtr host = &caps->host;
@@ -4457,7 +4458,8 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr
**seclabels_rtn,
{
virSecurityDeviceLabelDefPtr *seclabels;
size_t nseclabels = 0;
- int n, i, j;
+ int n;
+ size_t i, j;
xmlNodePtr *list = NULL;
virSecurityLabelDefPtr vmDef = NULL;
char *model, *relabel, *label;
@@ -5362,7 +5364,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
}
- int i;
+ size_t i;
if ((i = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk ioeventfd mode '%s'"),
@@ -5425,7 +5427,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
}
if (startupPolicy) {
- int i;
+ size_t i;
if ((i = virDomainStartupPolicyTypeFromString(startupPolicy)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -6518,7 +6520,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
def->driver.virtio.txmode = m;
}
if (ioeventfd) {
- int i;
+ size_t i;
if ((i = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown interface ioeventfd mode
'%s'"),
@@ -7145,7 +7147,7 @@ virDomainSmartcardDefParseXML(xmlNodePtr node,
char *mode = NULL;
char *type = NULL;
virDomainSmartcardDefPtr def;
- int i;
+ size_t i;
if (VIR_ALLOC(def) < 0) {
virReportOOMError();
@@ -7827,16 +7829,16 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
goto error;
if (nListens > 0) {
- int ii;
+ size_t i;
if (VIR_ALLOC_N(def->listens, nListens) < 0) {
virReportOOMError();
goto error;
}
- for (ii = 0; ii < nListens; ii++) {
- int ret = virDomainGraphicsListenDefParseXML(&def->listens[ii],
- listenNodes[ii],
+ for (i = 0; i < nListens; i++) {
+ int ret = virDomainGraphicsListenDefParseXML(&def->listens[i],
+ listenNodes[i],
flags);
if (ret < 0)
goto error;
@@ -7866,12 +7868,12 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
* graphics. */
bool matched = false;
const char *found = NULL;
- int ii;
+ size_t i;
- for (ii = 0; ii < nListens; ii++) {
- if (virDomainGraphicsListenGetType(def, ii)
+ for (i = 0; i < nListens; i++) {
+ if (virDomainGraphicsListenGetType(def, i)
== VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
- found = virDomainGraphicsListenGetAddress(def, ii);
+ found = virDomainGraphicsListenGetAddress(def, i);
if (STREQ_NULLABLE(found, listenAddr)) {
matched = true;
}
@@ -8377,7 +8379,7 @@ virDomainSoundDefParseXML(const xmlNodePtr node,
goto error;
if (ncodecs > 0) {
- int ii;
+ size_t i;
if (VIR_ALLOC_N(def->codecs, ncodecs) < 0) {
virReportOOMError();
@@ -8385,8 +8387,8 @@ virDomainSoundDefParseXML(const xmlNodePtr node,
goto error;
}
- for (ii = 0; ii < ncodecs; ii++) {
- virDomainSoundCodecDefPtr codec =
virDomainSoundCodecDefParseXML(codecNodes[ii]);
+ for (i = 0; i < ncodecs; i++) {
+ virDomainSoundCodecDefPtr codec =
virDomainSoundCodecDefParseXML(codecNodes[i]);
if (codec == NULL)
goto error;
@@ -9689,7 +9691,7 @@ virDomainHostdevFind(virDomainDefPtr def,
virDomainHostdevDefPtr *found)
{
virDomainHostdevDefPtr local_found;
- int i;
+ size_t i;
if (!found)
found = &local_found;
@@ -9709,7 +9711,7 @@ virDomainDiskIndexByName(virDomainDefPtr def, const char *name,
bool allow_ambiguous)
{
virDomainDiskDefPtr vdisk;
- int i;
+ size_t i;
int candidate = -1;
/* We prefer the <target dev='name'/> name (it's shorter, required
@@ -9739,9 +9741,9 @@ virDomainDiskIndexByName(virDomainDefPtr def, const char *name,
const char *
virDomainDiskPathByName(virDomainDefPtr def, const char *name)
{
- int i = virDomainDiskIndexByName(def, name, true);
+ int idx = virDomainDiskIndexByName(def, name, true);
- return i < 0 ? NULL : def->disks[i]->src;
+ return idx < 0 ? NULL : def->disks[idx]->src;
}
int virDomainDiskInsert(virDomainDefPtr def,
@@ -9759,7 +9761,7 @@ int virDomainDiskInsert(virDomainDefPtr def,
void virDomainDiskInsertPreAlloced(virDomainDefPtr def,
virDomainDiskDefPtr disk)
{
- int i;
+ int idx;
/* Tenatively plan to insert disk at the end. */
int insertAt = -1;
@@ -9768,19 +9770,19 @@ void virDomainDiskInsertPreAlloced(virDomainDefPtr def,
* index greater than the new one, insert at
* that position
*/
- for (i = (def->ndisks - 1); i >= 0; i--) {
+ for (idx = (def->ndisks - 1); idx >= 0; idx--) {
/* If bus matches and current disk is after
* new disk, then new disk should go here */
- if (def->disks[i]->bus == disk->bus &&
- (virDiskNameToIndex(def->disks[i]->dst) >
+ if (def->disks[idx]->bus == disk->bus &&
+ (virDiskNameToIndex(def->disks[idx]->dst) >
virDiskNameToIndex(disk->dst))) {
- insertAt = i;
- } else if (def->disks[i]->bus == disk->bus &&
+ insertAt = idx;
+ } else if (def->disks[idx]->bus == disk->bus &&
insertAt == -1) {
/* Last disk with match bus is before the
* new disk, then put new disk just after
*/
- insertAt = i + 1;
+ insertAt = idx + 1;
}
}
@@ -9822,10 +9824,10 @@ virDomainDiskRemove(virDomainDefPtr def, size_t i)
virDomainDiskDefPtr
virDomainDiskRemoveByName(virDomainDefPtr def, const char *name)
{
- int i = virDomainDiskIndexByName(def, name, false);
- if (i < 0)
+ int idx = virDomainDiskIndexByName(def, name, false);
+ if (idx < 0)
return NULL;
- return virDomainDiskRemove(def, i);
+ return virDomainDiskRemove(def, idx);
}
/* Return true if VM has at least one disk involved in a current block
@@ -9833,7 +9835,7 @@ virDomainDiskRemoveByName(virDomainDefPtr def, const char *name)
bool
virDomainHasDiskMirror(virDomainObjPtr vm)
{
- int i;
+ size_t i;
for (i = 0; i < vm->def->ndisks; i++)
if (vm->def->disks[i]->mirror)
return true;
@@ -9863,12 +9865,13 @@ int virDomainNetInsert(virDomainDefPtr def, virDomainNetDefPtr
net)
int
virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net)
{
- int ii, matchidx = -1;
+ size_t i;
+ int matchidx = -1;
bool PCIAddrSpecified = virDomainDeviceAddressIsValid(&net->info,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI);
- for (ii = 0; ii < def->nnets; ii++) {
- if (virMacAddrCmp(&def->nets[ii]->mac, &net->mac))
+ for (i = 0; i < def->nnets; i++) {
+ if (virMacAddrCmp(&def->nets[i]->mac, &net->mac))
continue;
if ((matchidx >= 0) && !PCIAddrSpecified) {
@@ -9882,17 +9885,17 @@ virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net)
break;
}
if (PCIAddrSpecified) {
- if (virDevicePCIAddressEqual(&def->nets[ii]->info.addr.pci,
+ if (virDevicePCIAddressEqual(&def->nets[i]->info.addr.pci,
&net->info.addr.pci)) {
/* exit early if the pci address was specified and
* it matches, as this guarantees no duplicates.
*/
- matchidx = ii;
+ matchidx = i;
break;
}
} else {
/* no PCI address given, so there may be multiple matches */
- matchidx = ii;
+ matchidx = i;
}
}
return matchidx;
@@ -9948,7 +9951,7 @@ int virDomainControllerInsert(virDomainDefPtr def,
void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
virDomainControllerDefPtr controller)
{
- int i;
+ int idx;
/* Tenatively plan to insert controller at the end. */
int insertAt = -1;
@@ -9957,18 +9960,18 @@ void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
* index greater than the new one, insert at
* that position
*/
- for (i = (def->ncontrollers - 1); i >= 0; i--) {
+ for (idx = (def->ncontrollers - 1); idx >= 0; idx--) {
/* If bus matches and current controller is after
* new controller, then new controller should go here */
- if (def->controllers[i]->type == controller->type &&
- def->controllers[i]->idx > controller->idx) {
- insertAt = i;
- } else if (def->controllers[i]->type == controller->type &&
+ if (def->controllers[idx]->type == controller->type &&
+ def->controllers[idx]->idx > controller->idx) {
+ insertAt = idx;
+ } else if (def->controllers[idx]->type == controller->type &&
insertAt == -1) {
/* Last controller with match bus is before the
* new controller, then put new controller just after
*/
- insertAt = i + 1;
+ insertAt = idx + 1;
}
}
@@ -9989,7 +9992,7 @@ int
virDomainControllerFind(virDomainDefPtr def,
int type, int idx)
{
- int i;
+ size_t i;
for (i = 0; i < def->ncontrollers; i++) {
if ((def->controllers[i]->type == type) &&
@@ -10027,7 +10030,7 @@ int virDomainLeaseIndex(virDomainDefPtr def,
virDomainLeaseDefPtr lease)
{
virDomainLeaseDefPtr vlease;
- int i;
+ size_t i;
for (i = 0; i < def->nleases; i++) {
vlease = def->leases[i];
@@ -10099,10 +10102,10 @@ virDomainLeaseDefPtr
virDomainLeaseRemove(virDomainDefPtr def,
virDomainLeaseDefPtr lease)
{
- int i = virDomainLeaseIndex(def, lease);
- if (i < 0)
+ int idx = virDomainLeaseIndex(def, lease);
+ if (idx < 0)
return NULL;
- return virDomainLeaseRemoveAt(def, i);
+ return virDomainLeaseRemoveAt(def, idx);
}
@@ -10143,7 +10146,8 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
virDomainDefPtr def)
{
xmlNodePtr *nodes = NULL;
- int i, n;
+ size_t i;
+ int n;
char *tmp = NULL;
int ret = -1;
unsigned long deviceBoot, serialPorts;
@@ -10393,7 +10397,7 @@ virDomainVcpuPinDefPtr
virDomainLookupVcpuPin(virDomainDefPtr def,
int vcpuid)
{
- int i;
+ size_t i;
if (!def->cputune.vcpupin)
return NULL;
@@ -10412,7 +10416,7 @@ virDomainDefMaybeAddController(virDomainDefPtr def,
int idx,
int model)
{
- int i;
+ size_t i;
virDomainControllerDefPtr cont;
for (i = 0; i < def->ncontrollers; i++) {
@@ -10509,7 +10513,7 @@ static int
virDomainDefMaybeAddHostdevSCSIcontroller(virDomainDefPtr def)
{
/* Look for any hostdev scsi dev */
- int i;
+ size_t i;
int maxController = -1;
virDomainHostdevDefPtr hostdev;
@@ -10541,7 +10545,8 @@ virDomainDefParseXML(xmlDocPtr xml,
{
xmlNodePtr *nodes = NULL, node = NULL;
char *tmp = NULL;
- int i, n;
+ size_t i;
+ int n;
long id = -1;
virDomainDefPtr def;
unsigned long count;
@@ -10719,7 +10724,7 @@ virDomainDefParseXML(xmlDocPtr xml,
goto no_memory;
for (i = 0; i < n; i++) {
- int j;
+ size_t j;
if (virDomainBlkioDeviceWeightParseXML(nodes[i],
&def->blkio.devices[i]) < 0)
goto error;
@@ -11674,7 +11679,7 @@ virDomainDefParseXML(xmlDocPtr xml,
if (chr->target.port == -1) {
int maxport = -1;
- int j;
+ size_t j;
for (j = 0; j < i; j++) {
if (def->parallels[j]->target.port > maxport)
maxport = def->parallels[j]->target.port;
@@ -11702,7 +11707,7 @@ virDomainDefParseXML(xmlDocPtr xml,
if (chr->target.port == -1) {
int maxport = -1;
- int j;
+ size_t j;
for (j = 0; j < i; j++) {
if (def->serials[j]->target.port > maxport)
maxport = def->serials[j]->target.port;
@@ -11760,7 +11765,7 @@ virDomainDefParseXML(xmlDocPtr xml,
if (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL &&
chr->info.addr.vioserial.port == 0) {
int maxport = 0;
- int j;
+ size_t j;
for (j = 0; j < i; j++) {
virDomainChrDefPtr thischr = def->channels[j];
if (thischr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL
&&
@@ -11880,8 +11885,8 @@ virDomainDefParseXML(xmlDocPtr xml,
if (n && VIR_ALLOC_N(def->videos, n) < 0)
goto no_memory;
for (i = 0; i < n; i++) {
- size_t ii = def->nvideos;
- virDomainVideoDefPtr video = virDomainVideoDefParseXML(nodes[i],
+ size_t j = def->nvideos;
+ virDomainVideoDefPtr video = virDomainVideoDefParseXML(nodes[j],
def,
flags);
if (!video)
@@ -11895,11 +11900,11 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error;
}
- ii = 0;
+ j = 0;
primaryVideo = true;
}
if (VIR_INSERT_ELEMENT_INPLACE(def->videos,
- ii,
+ j,
def->nvideos,
video) < 0) {
virDomainVideoDefFree(video);
@@ -12260,7 +12265,8 @@ virDomainObjParseXML(xmlDocPtr xml,
xmlNodePtr oldnode;
virDomainObjPtr obj;
xmlNodePtr *nodes = NULL;
- int i, n;
+ size_t i;
+ int n;
int state;
int reason = 0;
@@ -13087,7 +13093,7 @@ static bool
virDomainRedirFilterDefCheckABIStability(virDomainRedirFilterDefPtr src,
virDomainRedirFilterDefPtr dst)
{
- int i;
+ size_t i;
if (src->nusbdevs != dst->nusbdevs) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -13144,7 +13150,7 @@ bool
virDomainDefCheckABIStability(virDomainDefPtr src,
virDomainDefPtr dst)
{
- int i;
+ size_t i;
if (src->virtType != dst->virtType) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -13489,7 +13495,7 @@ virDomainDefAddDiskControllersForType(virDomainDefPtr def,
int controllerType,
int diskBus)
{
- int i;
+ size_t i;
int maxController = -1;
for (i = 0; i < def->ndisks; i++) {
@@ -13516,7 +13522,7 @@ static int
virDomainDefMaybeAddVirtioSerialController(virDomainDefPtr def)
{
/* Look for any virtio serial or virtio console devs */
- int i;
+ size_t i;
for (i = 0; i < def->nchannels; i++) {
virDomainChrDefPtr channel = def->channels[i];
@@ -13555,7 +13561,7 @@ static int
virDomainDefMaybeAddSmartcardController(virDomainDefPtr def)
{
/* Look for any smartcard devs */
- int i;
+ size_t i;
for (i = 0; i < def->nsmartcards; i++) {
virDomainSmartcardDefPtr smartcard = def->smartcards[i];
@@ -13565,7 +13571,7 @@ virDomainDefMaybeAddSmartcardController(virDomainDefPtr def)
idx = smartcard->info.addr.ccid.controller;
} else if (smartcard->info.type
== VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
- int j;
+ size_t j;
int max = -1;
for (j = 0; j < def->nsmartcards; j++) {
@@ -13637,7 +13643,7 @@ virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def,
int nvcpupin,
int vcpu)
{
- int i;
+ size_t i;
if (!def || !nvcpupin)
return 0;
@@ -13655,7 +13661,7 @@ virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def,
int nvcpupin,
int vcpu)
{
- int i;
+ size_t i;
if (!def || !nvcpupin)
return NULL;
@@ -14008,7 +14014,7 @@ virDomainDiskSourceDefFormat(virBufferPtr buf,
if (def->nhosts == 0) {
virBufferAddLit(buf, "/>\n");
} else {
- int i;
+ size_t i;
virBufferAddLit(buf, ">\n");
for (i = 0; i < def->nhosts; i++) {
@@ -14362,7 +14368,7 @@ int
virDomainFSIndexByName(virDomainDefPtr def, const char *name)
{
virDomainFSDefPtr fs;
- int i;
+ size_t i;
for (i = 0; i < def->nfss; i++) {
fs = def->fss[i];
@@ -15149,7 +15155,7 @@ virDomainSoundDefFormat(virBufferPtr buf,
{
const char *model = virDomainSoundModelTypeToString(def->model);
bool children = false;
- int i;
+ size_t i;
if (!model) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -15585,7 +15591,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
const char *type = virDomainGraphicsTypeToString(def->type);
const char *listenAddr = NULL;
bool children = false;
- int i;
+ size_t i;
if (!type) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -15955,7 +15961,7 @@ virDomainHubDefFormat(virBufferPtr buf,
static bool
virDomainIsAllVcpupinInherited(virDomainDefPtr def)
{
- int i;
+ size_t i;
if (!def->cpumask) {
if (def->cputune.nvcpupin)
@@ -16009,7 +16015,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
char uuidstr[VIR_UUID_STRING_BUFLEN];
const char *type = NULL;
int n;
- int i;
+ size_t i;
bool blkio = false;
virCheckFlags(DUMPXML_FLAGS |
@@ -16384,7 +16390,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
const char *name = virDomainFeatureTypeToString(i);
if (!name) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected feature %d"), i);
+ _("unexpected feature %zu"), i);
goto error;
}
virBufferAsprintf(buf, " <%s", name);
@@ -16687,7 +16693,7 @@ virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
virBuffer buf = VIR_BUFFER_INITIALIZER;
int state;
int reason;
- int i;
+ size_t i;
state = virDomainObjGetState(obj, &reason);
virBufferAsprintf(&buf, "<domstatus state='%s'
reason='%s' pid='%lld'>\n",
@@ -16727,7 +16733,7 @@ error:
static bool
virDomainDefHasUSB(virDomainDefPtr def)
{
- int i;
+ size_t i;
for (i = 0; i < def->ncontrollers; i++) {
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
@@ -17106,7 +17112,7 @@ virDiskNameToBusDeviceIndex(const virDomainDiskDefPtr disk,
virDomainFSDefPtr
virDomainGetRootFilesystem(virDomainDefPtr def)
{
- int i;
+ size_t i;
for (i = 0; i < def->nfss; i++) {
if (STREQ(def->fss[i]->dst, "/"))
@@ -17243,7 +17249,7 @@ virDomainObjListGetInactiveNames(virDomainObjListPtr doms,
{
struct virDomainNameData data = { filter, conn,
0, 0, maxnames, names };
- int i;
+ size_t i;
virObjectLock(doms);
virHashForEach(doms->objs, virDomainObjListCopyInactiveNames, &data);
virObjectUnlock(doms);
@@ -17295,7 +17301,7 @@ virDomainChrDefForeach(virDomainDefPtr def,
virDomainChrDefIterator iter,
void *opaque)
{
- int i;
+ size_t i;
int rc = 0;
for (i = 0; i < def->nserials; i++) {
@@ -17348,7 +17354,7 @@ virDomainSmartcardDefForeach(virDomainDefPtr def,
virDomainSmartcardDefIterator iter,
void *opaque)
{
- int i;
+ size_t i;
int rc = 0;
for (i = 0; i < def->nsmartcards; i++) {
@@ -17673,28 +17679,28 @@ virDomainNetGetActualVlan(virDomainNetDefPtr iface)
return 0;
}
-/* Return listens[ii] from the appropriate union for the graphics
+/* Return listens[i] from the appropriate union for the graphics
* type, or NULL if this is an unsuitable type, or the index is out of
- * bounds. If force0 is TRUE, ii == 0, and there is no listen array,
+ * bounds. If force0 is TRUE, i == 0, and there is no listen array,
* allocate one with a single item. */
static virDomainGraphicsListenDefPtr
-virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t ii, bool force0)
+virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t i, bool force0)
{
if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC ||
def->type == VIR_DOMAIN_GRAPHICS_TYPE_RDP ||
def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
- if (!def->listens && (ii == 0) && force0) {
+ if (!def->listens && (i == 0) && force0) {
if (VIR_ALLOC(def->listens) < 0)
virReportOOMError();
else
def->nListens = 1;
}
- if (!def->listens || (def->nListens <= ii))
+ if (!def->listens || (def->nListens <= i))
return NULL;
- return &def->listens[ii];
+ return &def->listens[i];
}
/* it's a type that has no listens array */
@@ -17716,10 +17722,10 @@ virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t
ii, bool force0)
* return 0 on success, -1 on failure. */
int
-virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t ii)
+virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t i)
{
virDomainGraphicsListenDefPtr listenInfo
- = virDomainGraphicsGetListen(def, ii, false);
+ = virDomainGraphicsGetListen(def, i, false);
if (!listenInfo)
return VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE;
@@ -17731,10 +17737,10 @@ virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def,
size_t ii)
* *will not* free any existing address or network based on a change
* in value of type. */
int
-virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t ii, int val)
+virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t i, int val)
{
virDomainGraphicsListenDefPtr listenInfo
- = virDomainGraphicsGetListen(def, ii, true);
+ = virDomainGraphicsGetListen(def, i, true);
if (!listenInfo)
return -1;
@@ -17744,10 +17750,10 @@ virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def,
size_t ii, int val)
const char *
-virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def, size_t ii)
+virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def, size_t i)
{
virDomainGraphicsListenDefPtr listenInfo
- = virDomainGraphicsGetListen(def, ii, false);
+ = virDomainGraphicsGetListen(def, i, false);
/* even a network can have a listen address */
if (!listenInfo ||
@@ -17759,15 +17765,15 @@ virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def,
size_t ii)
/* Make a copy of up to len characters of address, and store it in
- * listens[ii].address. If setType is true, set the listen's type
+ * listens[i].address. If setType is true, set the listen's type
* to 'address', otherwise leave type alone. */
int
virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def,
- size_t ii, const char *address,
+ size_t i, const char *address,
int len, bool setType)
{
virDomainGraphicsListenDefPtr listenInfo
- = virDomainGraphicsGetListen(def, ii, true);
+ = virDomainGraphicsGetListen(def, i, true);
if (!listenInfo)
return -1;
@@ -17787,10 +17793,10 @@ virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def,
const char *
-virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def, size_t ii)
+virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def, size_t i)
{
virDomainGraphicsListenDefPtr listenInfo
- = virDomainGraphicsGetListen(def, ii, false);
+ = virDomainGraphicsGetListen(def, i, false);
if (!listenInfo ||
(listenInfo->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK))
@@ -17800,13 +17806,13 @@ virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def,
size_t ii)
/* Make a copy of up to len characters of address, and store it in
- * listens[ii].network */
+ * listens[i].network */
int
virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def,
- size_t ii, const char *network, int len)
+ size_t i, const char *network, int len)
{
virDomainGraphicsListenDefPtr listenInfo
- = virDomainGraphicsGetListen(def, ii, true);
+ = virDomainGraphicsGetListen(def, i, true);
if (!listenInfo)
return -1;
@@ -17838,7 +17844,7 @@ virDomainNetFind(virDomainDefPtr def, const char *device)
bool isMac = false;
virDomainNetDefPtr net = NULL;
virMacAddr mac;
- int i;
+ size_t i;
if (virMacAddrParse(device, &mac) == 0)
isMac = true;
@@ -18068,7 +18074,7 @@ virDomainObjListExport(virDomainObjListPtr doms,
unsigned int flags)
{
int ret = -1;
- int i;
+ size_t i;
struct virDomainListData data = {
conn, NULL,
@@ -18113,7 +18119,7 @@ cleanup:
virSecurityLabelDefPtr
virDomainDefGetSecurityLabelDef(virDomainDefPtr def, const char *model)
{
- int i;
+ size_t i;
virSecurityLabelDefPtr seclabel = NULL;
if (def == NULL || model == NULL)
@@ -18132,7 +18138,7 @@ virDomainDefGetSecurityLabelDef(virDomainDefPtr def, const char
*model)
virSecurityDeviceLabelDefPtr
virDomainDiskDefGetSecurityLabelDef(virDomainDiskDefPtr def, const char *model)
{
- int i;
+ size_t i;
if (def == NULL)
return NULL;
@@ -18147,7 +18153,7 @@ virDomainDiskDefGetSecurityLabelDef(virDomainDiskDefPtr def, const
char *model)
virSecurityDeviceLabelDefPtr
virDomainChrDefGetSecurityLabelDef(virDomainChrDefPtr def, const char *model)
{
- int i;
+ size_t i;
if (def == NULL)
return NULL;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index da83eb6..4a7dcd2 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2342,22 +2342,22 @@ virDomainHostdevRemove(virDomainDefPtr def, size_t i);
int virDomainHostdevFind(virDomainDefPtr def, virDomainHostdevDefPtr match,
virDomainHostdevDefPtr *found);
-int virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t ii)
+int virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t i)
ATTRIBUTE_NONNULL(1);
-int virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t ii, int val)
+int virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t i, int val)
ATTRIBUTE_NONNULL(1);
const char *virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def,
- size_t ii)
+ size_t i)
ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def,
- size_t ii, const char *address,
+ size_t i, const char *address,
int len, bool setType)
ATTRIBUTE_NONNULL(1);
const char *virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def,
- size_t ii)
+ size_t i)
ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def,
- size_t ii, const char *network, int len)
+ size_t i, const char *network, int len)
ATTRIBUTE_NONNULL(1);
int virDomainNetGetActualType(virDomainNetDefPtr iface);
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index bc43c28..422f471 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -134,7 +134,7 @@ struct _virDomainEvent {
static void
virDomainEventCallbackListFree(virDomainEventCallbackListPtr list)
{
- int i;
+ size_t i;
if (!list)
return;
@@ -162,7 +162,7 @@ virDomainEventCallbackListRemove(virConnectPtr conn,
virConnectDomainEventCallback callback)
{
int ret = 0;
- int i;
+ size_t i;
for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback)
&&
cbList->callbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE
&&
@@ -213,7 +213,7 @@ virDomainEventCallbackListRemoveID(virConnectPtr conn,
int callbackID)
{
int ret = 0;
- int i;
+ size_t i;
for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->callbackID == callbackID &&
cbList->callbacks[i]->conn == conn) {
@@ -255,7 +255,7 @@ virDomainEventCallbackListMarkDelete(virConnectPtr conn,
virConnectDomainEventCallback callback)
{
int ret = 0;
- int i;
+ size_t i;
for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback)
&&
cbList->callbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE
&&
@@ -281,7 +281,7 @@ virDomainEventCallbackListMarkDeleteID(virConnectPtr conn,
int callbackID)
{
int ret = 0;
- int i;
+ size_t i;
for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->callbackID == callbackID &&
cbList->callbacks[i]->conn == conn) {
@@ -304,7 +304,7 @@ static int
virDomainEventCallbackListPurgeMarked(virDomainEventCallbackListPtr cbList)
{
int old_count = cbList->count;
- int i;
+ size_t i;
for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->deleted) {
virFreeCallback freecb = cbList->callbacks[i]->freecb;
@@ -352,7 +352,7 @@ virDomainEventCallbackListAddID(virConnectPtr conn,
int *callbackID)
{
virDomainEventCallbackPtr event;
- int i;
+ size_t i;
int ret = 0;
/* Check incoming */
@@ -457,7 +457,7 @@ virDomainEventCallbackListEventID(virConnectPtr conn,
virDomainEventCallbackListPtr cbList,
int callbackID)
{
- int i;
+ size_t i;
for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->deleted)
@@ -498,7 +498,7 @@ void virDomainEventFree(virDomainEventPtr event)
}
VIR_FREE(event->data.graphics.authScheme);
if (event->data.graphics.subject) {
- int i;
+ size_t i;
for (i = 0; i < event->data.graphics.subject->nidentity; i++) {
VIR_FREE(event->data.graphics.subject->identities[i].type);
VIR_FREE(event->data.graphics.subject->identities[i].name);
@@ -534,7 +534,7 @@ void virDomainEventFree(virDomainEventPtr event)
static void
virDomainEventQueueClear(virDomainEventQueuePtr queue)
{
- int i;
+ size_t i;
if (!queue)
return;
@@ -1359,7 +1359,7 @@ virDomainEventDispatch(virDomainEventPtr event,
virDomainEventDispatchFunc dispatch,
void *opaque)
{
- int i;
+ size_t i;
/* Cache this now, since we may be dropping the lock,
and have more callbacks added. We're guaranteed not
to have any removed */
@@ -1384,7 +1384,7 @@ virDomainEventQueueDispatch(virDomainEventQueuePtr queue,
virDomainEventDispatchFunc dispatch,
void *opaque)
{
- int i;
+ size_t i;
for (i = 0; i < queue->count; i++) {
virDomainEventDispatch(queue->events[i], callbacks, dispatch, opaque);
diff --git a/src/conf/domain_nwfilter.c b/src/conf/domain_nwfilter.c
index f42905e..688a200 100644
--- a/src/conf/domain_nwfilter.c
+++ b/src/conf/domain_nwfilter.c
@@ -53,7 +53,7 @@ virDomainConfNWFilterTeardown(virDomainNetDefPtr net) {
void
virDomainConfVMNWFilterTeardown(virDomainObjPtr vm) {
- int i;
+ size_t i;
if (nwfilterDriver != NULL) {
for (i = 0; i < vm->def->nnets; i++)
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index 025a454..08cc693 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -54,12 +54,12 @@ void virInterfaceIpDefFree(virInterfaceIpDefPtr def) {
static
void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def) {
- int ii;
+ size_t i;
if (def == NULL)
return;
- for (ii = 0; ii < def->nips; ii++) {
- virInterfaceIpDefFree(def->ips[ii]);
+ for (i = 0; i < def->nips; i++) {
+ virInterfaceIpDefFree(def->ips[i]);
}
VIR_FREE(def->ips);
VIR_FREE(def->family);
@@ -69,7 +69,8 @@ void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def) {
void virInterfaceDefFree(virInterfaceDefPtr def)
{
- int i, pp;
+ size_t i;
+ int pp;
if (def == NULL)
return;
@@ -299,7 +300,8 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
xmlXPathContextPtr ctxt) {
xmlNodePtr dhcp;
xmlNodePtr *ipNodes = NULL;
- int nIpNodes, ii, ret = -1;
+ int nIpNodes, ret = -1;
+ size_t i;
char *tmp;
tmp = virXPathString("string(./route[1]/@gateway)", ctxt);
@@ -324,7 +326,7 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
}
def->nips = 0;
- for (ii = 0; ii < nIpNodes; ii++) {
+ for (i = 0; i < nIpNodes; i++) {
virInterfaceIpDefPtr ip;
@@ -333,7 +335,7 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
goto error;
}
- ctxt->node = ipNodes[ii];
+ ctxt->node = ipNodes[i];
ret = virInterfaceDefParseIp(ip, ctxt);
if (ret != 0) {
virInterfaceIpDefFree(ip);
@@ -354,7 +356,8 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
xmlXPathContextPtr ctxt) {
xmlNodePtr dhcp, autoconf;
xmlNodePtr *ipNodes = NULL;
- int nIpNodes, ii, ret = -1;
+ int nIpNodes, ret = -1;
+ size_t i;
char *tmp;
tmp = virXPathString("string(./route[1]/@gateway)", ctxt);
@@ -383,7 +386,7 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
}
def->nips = 0;
- for (ii = 0; ii < nIpNodes; ii++) {
+ for (i = 0; i < nIpNodes; i++) {
virInterfaceIpDefPtr ip;
@@ -392,7 +395,7 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
goto error;
}
- ctxt->node = ipNodes[ii];
+ ctxt->node = ipNodes[i];
ret = virInterfaceDefParseIp(ip, ctxt);
if (ret != 0) {
virInterfaceIpDefFree(ip);
@@ -487,7 +490,8 @@ virInterfaceDefParseBridge(virInterfaceDefPtr def,
xmlNodePtr *interfaces = NULL;
xmlNodePtr bridge;
virInterfaceDefPtr itf;
- int nbItf, i;
+ int nbItf;
+ size_t i;
int ret = 0;
bridge = ctxt->node;
@@ -528,7 +532,8 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
xmlNodePtr *interfaces = NULL;
xmlNodePtr bond = ctxt->node;
virInterfaceDefPtr itf;
- int nbItf, i;
+ int nbItf;
+ size_t i;
int ret = 0;
nbItf = virXPathNodeSet("./interface", ctxt, &interfaces);
@@ -874,7 +879,7 @@ virInterfaceDefPtr virInterfaceDefParseFile(const char *filename)
static int
virInterfaceBridgeDefFormat(virBufferPtr buf,
const virInterfaceDefPtr def, int level) {
- int i;
+ size_t i;
int ret = 0;
virBufferAsprintf(buf, "%*s <bridge", level*2, "");
@@ -899,7 +904,7 @@ virInterfaceBridgeDefFormat(virBufferPtr buf,
static int
virInterfaceBondDefFormat(virBufferPtr buf,
const virInterfaceDefPtr def, int level) {
- int i;
+ size_t i;
int ret = 0;
virBufferAsprintf(buf, "%*s <bond", level*2, "");
@@ -981,43 +986,43 @@ virInterfaceVlanDefFormat(virBufferPtr buf,
static int
virInterfaceProtocolDefFormat(virBufferPtr buf, const virInterfaceDefPtr def,
int level) {
- int pp, ii;
+ size_t i, j;
- for (pp = 0; pp < def->nprotos; pp++) {
+ for (i = 0; i < def->nprotos; i++) {
virBufferAsprintf(buf, "%*s <protocol family='%s'>\n",
- level*2, "", def->protos[pp]->family);
+ level*2, "", def->protos[i]->family);
- if (def->protos[pp]->autoconf) {
+ if (def->protos[i]->autoconf) {
virBufferAsprintf(buf, "%*s <autoconf/>\n", level*2,
"");
}
- if (def->protos[pp]->dhcp) {
- if (def->protos[pp]->peerdns == 0)
+ if (def->protos[i]->dhcp) {
+ if (def->protos[i]->peerdns == 0)
virBufferAsprintf(buf, "%*s <dhcp
peerdns='no'/>\n",
level*2, "");
- else if (def->protos[pp]->peerdns == 1)
+ else if (def->protos[i]->peerdns == 1)
virBufferAsprintf(buf, "%*s <dhcp
peerdns='yes'/>\n",
level*2, "");
else
virBufferAsprintf(buf, "%*s <dhcp/>\n", level*2,
"");
}
- for (ii = 0; ii < def->protos[pp]->nips; ii++) {
- if (def->protos[pp]->ips[ii]->address != NULL) {
+ for (j = 0; j < def->protos[i]->nips; j++) {
+ if (def->protos[i]->ips[j]->address != NULL) {
virBufferAsprintf(buf, "%*s <ip address='%s'",
level*2, "",
- def->protos[pp]->ips[ii]->address);
- if (def->protos[pp]->ips[ii]->prefix != 0) {
+ def->protos[i]->ips[j]->address);
+ if (def->protos[i]->ips[j]->prefix != 0) {
virBufferAsprintf(buf, " prefix='%d'",
- def->protos[pp]->ips[ii]->prefix);
+ def->protos[i]->ips[j]->prefix);
}
virBufferAddLit(buf, "/>\n");
}
}
- if (def->protos[pp]->gateway != NULL) {
+ if (def->protos[i]->gateway != NULL) {
virBufferAsprintf(buf, "%*s <route
gateway='%s'/>\n",
- level*2, "", def->protos[pp]->gateway);
+ level*2, "", def->protos[i]->gateway);
}
virBufferAsprintf(buf, "%*s </protocol>\n", level*2,
"");
@@ -1169,7 +1174,8 @@ int virInterfaceFindByMACString(const virInterfaceObjListPtr
interfaces,
const char *mac,
virInterfaceObjPtr *matches, int maxmatches)
{
- unsigned int i, matchct = 0;
+ size_t i;
+ unsigned int matchct = 0;
for (i = 0; i < interfaces->count; i++) {
@@ -1193,7 +1199,7 @@ virInterfaceObjPtr virInterfaceFindByName(const
virInterfaceObjListPtr
interfaces,
const char *name)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < interfaces->count; i++) {
virInterfaceObjLock(interfaces->objs[i]);
@@ -1207,7 +1213,7 @@ virInterfaceObjPtr virInterfaceFindByName(const
virInterfaceObjListPtr
void virInterfaceObjListFree(virInterfaceObjListPtr interfaces)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < interfaces->count; i++)
virInterfaceObjFree(interfaces->objs[i]);
@@ -1220,7 +1226,8 @@ int virInterfaceObjListClone(virInterfaceObjListPtr src,
virInterfaceObjListPtr dest)
{
int ret = -1;
- unsigned int i, cnt;
+ size_t i;
+ unsigned int cnt;
if (!src || !dest)
goto cleanup;
@@ -1295,7 +1302,7 @@ virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr
interfaces,
void virInterfaceRemove(virInterfaceObjListPtr interfaces,
const virInterfaceObjPtr iface)
{
- unsigned int i;
+ size_t i;
virInterfaceObjUnlock(iface);
for (i = 0; i < interfaces->count; i++) {
diff --git a/src/conf/netdev_vlan_conf.c b/src/conf/netdev_vlan_conf.c
index 880a7ce..94a5ce1 100644
--- a/src/conf/netdev_vlan_conf.c
+++ b/src/conf/netdev_vlan_conf.c
@@ -39,7 +39,8 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt,
virNetDevVlanPtr de
const char *trunk = NULL;
const char *nativeMode = NULL;
xmlNodePtr *tagNodes = NULL;
- int nTags, ii;
+ int nTags;
+ size_t i;
ctxt->node = node;
@@ -61,10 +62,10 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt,
virNetDevVlanPtr de
def->nativeMode = 0;
def->nativeTag = 0;
- for (ii = 0; ii < nTags; ii++) {
+ for (i = 0; i < nTags; i++) {
unsigned long id;
- ctxt->node = tagNodes[ii];
+ ctxt->node = tagNodes[i];
if (virXPathULong("string(./@id)", ctxt, &id) < 0) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("missing or invalid vlan tag id attribute"));
@@ -92,7 +93,7 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt,
virNetDevVlanPtr de
VIR_FREE(nativeMode);
def->nativeTag = id;
}
- def->tag[ii] = id;
+ def->tag[i] = id;
}
def->nTags = nTags;
@@ -143,7 +144,7 @@ cleanup:
int
virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf)
{
- int ii;
+ size_t i;
if (def->nTags == 0)
return 0;
@@ -155,9 +156,9 @@ virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf)
}
virBufferAsprintf(buf, "<vlan%s>\n", def->trunk ? "
trunk='yes'" : "");
- for (ii = 0; ii < def->nTags; ii++) {
+ for (i = 0; i < def->nTags; i++) {
if (def->nativeMode != VIR_NATIVE_VLAN_MODE_DEFAULT &&
- def->nativeTag == def->tag[ii]) {
+ def->nativeTag == def->tag[i]) {
/* check the nativeMode in case we get <tag id='0'/>*/
const char *mode = virNativeVlanModeTypeToString(def->nativeMode);
if (!mode) {
@@ -165,9 +166,9 @@ virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf)
_("Bad value for nativeMode"));
}
virBufferAsprintf(buf, " <tag id='%u'
nativeMode='%s'/>\n",
- def->tag[ii], mode);
+ def->tag[i], mode);
} else {
- virBufferAsprintf(buf, " <tag id='%u'/>\n",
def->tag[ii]);
+ virBufferAsprintf(buf, " <tag id='%u'/>\n",
def->tag[i]);
}
}
virBufferAddLit(buf, "</vlan>\n");
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 64fd581..29bd8f4 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -69,7 +69,7 @@ VIR_ENUM_IMPL(virNetworkForwardDriverName,
virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets,
const unsigned char *uuid)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < nets->count; i++) {
virNetworkObjLock(nets->objs[i]);
@@ -84,7 +84,7 @@ virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets,
virNetworkObjPtr virNetworkFindByName(const virNetworkObjListPtr nets,
const char *name)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < nets->count; i++) {
virNetworkObjLock(nets->objs[i]);
@@ -195,15 +195,15 @@ virNetworkDNSDefClear(virNetworkDNSDefPtr def)
static void
virNetworkForwardDefClear(virNetworkForwardDefPtr def)
{
- int ii;
+ size_t i;
- for (ii = 0; ii < def->npfs && def->pfs; ii++) {
- virNetworkForwardPfDefClear(&def->pfs[ii]);
+ for (i = 0; i < def->npfs && def->pfs; i++) {
+ virNetworkForwardPfDefClear(&def->pfs[i]);
}
VIR_FREE(def->pfs);
- for (ii = 0; ii < def->nifs && def->ifs; ii++) {
- virNetworkForwardIfDefClear(&def->ifs[ii]);
+ for (i = 0; i < def->nifs && def->ifs; i++) {
+ virNetworkForwardIfDefClear(&def->ifs[i]);
}
VIR_FREE(def->ifs);
}
@@ -211,7 +211,7 @@ virNetworkForwardDefClear(virNetworkForwardDefPtr def)
void
virNetworkDefFree(virNetworkDefPtr def)
{
- int ii;
+ size_t i;
if (!def)
return;
@@ -222,18 +222,18 @@ virNetworkDefFree(virNetworkDefPtr def)
virNetworkForwardDefClear(&def->forward);
- for (ii = 0; ii < def->nips && def->ips; ii++) {
- virNetworkIpDefClear(&def->ips[ii]);
+ for (i = 0; i < def->nips && def->ips; i++) {
+ virNetworkIpDefClear(&def->ips[i]);
}
VIR_FREE(def->ips);
- for (ii = 0; ii < def->nroutes && def->routes; ii++) {
- virNetworkRouteDefClear(&def->routes[ii]);
+ for (i = 0; i < def->nroutes && def->routes; i++) {
+ virNetworkRouteDefClear(&def->routes[i]);
}
VIR_FREE(def->routes);
- for (ii = 0; ii < def->nPortGroups && def->portGroups; ii++) {
- virPortGroupDefClear(&def->portGroups[ii]);
+ for (i = 0; i < def->nPortGroups && def->portGroups; i++) {
+ virPortGroupDefClear(&def->portGroups[i]);
}
VIR_FREE(def->portGroups);
@@ -262,7 +262,7 @@ void virNetworkObjFree(virNetworkObjPtr net)
void virNetworkObjListFree(virNetworkObjListPtr nets)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < nets->count; i++)
virNetworkObjFree(nets->objs[i]);
@@ -545,7 +545,7 @@ cleanup:
void virNetworkRemoveInactive(virNetworkObjListPtr nets,
const virNetworkObjPtr net)
{
- unsigned int i;
+ size_t i;
virNetworkObjUnlock(net);
for (i = 0; i < nets->count; i++) {
@@ -574,7 +574,7 @@ virNetworkIpDefPtr
virNetworkDefGetIpByIndex(const virNetworkDefPtr def,
int family, size_t n)
{
- int ii;
+ size_t i;
if (!def->ips || n >= def->nips)
return NULL;
@@ -584,10 +584,10 @@ virNetworkDefGetIpByIndex(const virNetworkDefPtr def,
}
/* find the nth ip of type "family" */
- for (ii = 0; ii < def->nips; ii++) {
- if (VIR_SOCKET_ADDR_IS_FAMILY(&def->ips[ii].address, family)
+ for (i = 0; i < def->nips; i++) {
+ if (VIR_SOCKET_ADDR_IS_FAMILY(&def->ips[i].address, family)
&& (n-- <= 0)) {
- return &def->ips[ii];
+ return &def->ips[i];
}
}
/* failed to find enough of the right family */
@@ -1049,7 +1049,8 @@ virNetworkDNSDefParseXML(const char *networkName,
xmlNodePtr *srvNodes = NULL;
xmlNodePtr *txtNodes = NULL;
int nhosts, nsrvs, ntxts;
- int ii, ret = -1;
+ size_t i;
+ int ret = -1;
xmlNodePtr save = ctxt->node;
ctxt->node = node;
@@ -1067,8 +1068,8 @@ virNetworkDNSDefParseXML(const char *networkName,
goto cleanup;
}
- for (ii = 0; ii < nhosts; ii++) {
- if (virNetworkDNSHostDefParseXML(networkName, hostNodes[ii],
+ for (i = 0; i < nhosts; i++) {
+ if (virNetworkDNSHostDefParseXML(networkName, hostNodes[i],
&def->hosts[def->nhosts], false)
< 0) {
goto cleanup;
}
@@ -1089,8 +1090,8 @@ virNetworkDNSDefParseXML(const char *networkName,
goto cleanup;
}
- for (ii = 0; ii < nsrvs; ii++) {
- if (virNetworkDNSSrvDefParseXML(networkName, srvNodes[ii], ctxt,
+ for (i = 0; i < nsrvs; i++) {
+ if (virNetworkDNSSrvDefParseXML(networkName, srvNodes[i], ctxt,
&def->srvs[def->nsrvs], false) <
0) {
goto cleanup;
}
@@ -1111,8 +1112,8 @@ virNetworkDNSDefParseXML(const char *networkName,
goto cleanup;
}
- for (ii = 0; ii < ntxts; ii++) {
- if (virNetworkDNSTxtDefParseXML(networkName, txtNodes[ii],
+ for (i = 0; i < ntxts; i++) {
+ if (virNetworkDNSTxtDefParseXML(networkName, txtNodes[i],
&def->txts[def->ntxts], false) <
0) {
goto cleanup;
}
@@ -1679,7 +1680,8 @@ virNetworkForwardDefParseXML(const char *networkName,
xmlXPathContextPtr ctxt,
virNetworkForwardDefPtr def)
{
- int ii, ret = -1;
+ size_t i;
+ int ret = -1;
xmlNodePtr *forwardIfNodes = NULL;
xmlNodePtr *forwardPfNodes = NULL;
xmlNodePtr *forwardAddrNodes = NULL;
@@ -1800,8 +1802,8 @@ virNetworkForwardDefParseXML(const char *networkName,
}
/* parse each <interface> */
- for (ii = 0; ii < nForwardIfs; ii++) {
- forwardDev = virXMLPropString(forwardIfNodes[ii], "dev");
+ for (i = 0; i < nForwardIfs; i++) {
+ forwardDev = virXMLPropString(forwardIfNodes[i], "dev");
if (!forwardDev) {
virReportError(VIR_ERR_XML_ERROR,
_("Missing required dev attribute in "
@@ -1810,7 +1812,7 @@ virNetworkForwardDefParseXML(const char *networkName,
goto cleanup;
}
- if ((ii == 0) && (def->nifs == 1)) {
+ if ((i == 0) && (def->nifs == 1)) {
/* both <forward dev='x'> and <interface
dev='x'/> are
* present. If they don't match, it's an error.
*/
@@ -1826,9 +1828,9 @@ virNetworkForwardDefParseXML(const char *networkName,
continue;
}
- def->ifs[ii].device.dev = forwardDev;
+ def->ifs[i].device.dev = forwardDev;
forwardDev = NULL;
- def->ifs[ii].type = VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV;
+ def->ifs[i].type = VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV;
def->nifs++;
}
@@ -1839,25 +1841,25 @@ virNetworkForwardDefParseXML(const char *networkName,
goto cleanup;
}
- for (ii = 0; ii < nForwardAddrs; ii++) {
- if (!(type = virXMLPropString(forwardAddrNodes[ii], "type"))) {
+ for (i = 0; i < nForwardAddrs; i++) {
+ if (!(type = virXMLPropString(forwardAddrNodes[i], "type"))) {
virReportError(VIR_ERR_XML_ERROR,
_("missing address type in network %s"),
networkName);
goto cleanup;
}
- if ((def->ifs[ii].type =
virNetworkForwardHostdevDeviceTypeFromString(type)) < 0) {
+ if ((def->ifs[i].type =
virNetworkForwardHostdevDeviceTypeFromString(type)) < 0) {
virReportError(VIR_ERR_XML_ERROR,
_("unknown address type '%s' in network
%s"),
type, networkName);
goto cleanup;
}
- switch (def->ifs[ii].type) {
+ switch (def->ifs[i].type) {
case VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI:
- if (virDevicePCIAddressParseXML(forwardAddrNodes[ii],
- &def->ifs[ii].device.pci) < 0)
{
+ if (virDevicePCIAddressParseXML(forwardAddrNodes[i],
+ &def->ifs[i].device.pci) < 0)
{
goto cleanup;
}
break;
@@ -2037,7 +2039,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
goto error;
if (nPortGroups > 0) {
- int ii;
+ size_t i;
/* allocate array to hold all the portgroups */
if (VIR_ALLOC_N(def->portGroups, nPortGroups) < 0) {
@@ -2045,9 +2047,9 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
goto error;
}
/* parse each portgroup */
- for (ii = 0; ii < nPortGroups; ii++) {
- int ret = virNetworkPortGroupParseXML(&def->portGroups[ii],
- portGroupNodes[ii], ctxt);
+ for (i = 0; i < nPortGroups; i++) {
+ int ret = virNetworkPortGroupParseXML(&def->portGroups[i],
+ portGroupNodes[i], ctxt);
if (ret < 0)
goto error;
def->nPortGroups++;
@@ -2060,7 +2062,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
goto error;
if (nIps > 0) {
- int ii;
+ size_t i;
/* allocate array to hold all the addrs */
if (VIR_ALLOC_N(def->ips, nIps) < 0) {
@@ -2068,9 +2070,9 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
goto error;
}
/* parse each addr */
- for (ii = 0; ii < nIps; ii++) {
- int ret = virNetworkIPDefParseXML(def->name, ipNodes[ii],
- ctxt, &def->ips[ii]);
+ for (i = 0; i < nIps; i++) {
+ int ret = virNetworkIPDefParseXML(def->name, ipNodes[i],
+ ctxt, &def->ips[i]);
if (ret < 0)
goto error;
def->nips++;
@@ -2083,7 +2085,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
goto error;
if (nRoutes > 0) {
- int ii;
+ size_t i;
/* allocate array to hold all the route definitions */
if (VIR_ALLOC_N(def->routes, nRoutes) < 0) {
@@ -2091,9 +2093,9 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
goto error;
}
/* parse each definition */
- for (ii = 0; ii < nRoutes; ii++) {
- int ret = virNetworkRouteDefParseXML(def->name, routeNodes[ii],
- ctxt, &def->routes[ii]);
+ for (i = 0; i < nRoutes; i++) {
+ int ret = virNetworkRouteDefParseXML(def->name, routeNodes[i],
+ ctxt, &def->routes[i]);
if (ret < 0)
goto error;
def->nroutes++;
@@ -2107,14 +2109,14 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
*/
nRoutes = def->nroutes;
nIps = def->nips;
- for (ii = 0; ii < nRoutes; ii++) {
- int jj;
+ for (i = 0; i < nRoutes; i++) {
+ size_t j;
virSocketAddr testAddr, testGw;
bool addrMatch;
- virNetworkRouteDefPtr gwdef = &def->routes[ii];
+ virNetworkRouteDefPtr gwdef = &def->routes[i];
addrMatch = false;
- for (jj = 0; jj < nIps; jj++) {
- virNetworkIpDefPtr def2 = &def->ips[jj];
+ for (j = 0; j < nIps; j++) {
+ virNetworkIpDefPtr def2 = &def->ips[j];
if (VIR_SOCKET_ADDR_FAMILY(&gwdef->gateway)
!= VIR_SOCKET_ADDR_FAMILY(&def2->address)) {
continue;
@@ -2283,7 +2285,7 @@ virNetworkDNSDefFormat(virBufferPtr buf,
virNetworkDNSDefPtr def)
{
int result = 0;
- int i;
+ size_t i, j;
if (!(def->nhosts || def->nsrvs || def->ntxts))
goto out;
@@ -2319,16 +2321,14 @@ virNetworkDNSDefFormat(virBufferPtr buf,
}
if (def->nhosts) {
- int ii, j;
-
- for (ii = 0; ii < def->nhosts; ii++) {
- char *ip = virSocketAddrFormat(&def->hosts[ii].ip);
+ for (i = 0; i < def->nhosts; i++) {
+ char *ip = virSocketAddrFormat(&def->hosts[i].ip);
virBufferAsprintf(buf, "<host ip='%s'>\n", ip);
virBufferAdjustIndent(buf, 2);
- for (j = 0; j < def->hosts[ii].nnames; j++)
+ for (j = 0; j < def->hosts[i].nnames; j++)
virBufferAsprintf(buf,
"<hostname>%s</hostname>\n",
- def->hosts[ii].names[j]);
+ def->hosts[i].names[j]);
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</host>\n");
@@ -2377,15 +2377,15 @@ virNetworkIpDefFormat(virBufferPtr buf,
def->tftproot);
}
if ((def->nranges || def->nhosts)) {
- int ii;
+ size_t i;
virBufferAddLit(buf, "<dhcp>\n");
virBufferAdjustIndent(buf, 2);
- for (ii = 0; ii < def->nranges; ii++) {
- char *saddr = virSocketAddrFormat(&def->ranges[ii].start);
+ for (i = 0; i < def->nranges; i++) {
+ char *saddr = virSocketAddrFormat(&def->ranges[i].start);
if (!saddr)
goto error;
- char *eaddr = virSocketAddrFormat(&def->ranges[ii].end);
+ char *eaddr = virSocketAddrFormat(&def->ranges[i].end);
if (!eaddr) {
VIR_FREE(saddr);
goto error;
@@ -2395,16 +2395,16 @@ virNetworkIpDefFormat(virBufferPtr buf,
VIR_FREE(saddr);
VIR_FREE(eaddr);
}
- for (ii = 0; ii < def->nhosts; ii++) {
+ for (i = 0; i < def->nhosts; i++) {
virBufferAddLit(buf, "<host ");
- if (def->hosts[ii].mac)
- virBufferAsprintf(buf, "mac='%s' ",
def->hosts[ii].mac);
- if (def->hosts[ii].id)
- virBufferAsprintf(buf, "id='%s' ",
def->hosts[ii].id);
- if (def->hosts[ii].name)
- virBufferAsprintf(buf, "name='%s' ",
def->hosts[ii].name);
- if (VIR_SOCKET_ADDR_VALID(&def->hosts[ii].ip)) {
- char *ipaddr = virSocketAddrFormat(&def->hosts[ii].ip);
+ if (def->hosts[i].mac)
+ virBufferAsprintf(buf, "mac='%s' ",
def->hosts[i].mac);
+ if (def->hosts[i].id)
+ virBufferAsprintf(buf, "id='%s' ",
def->hosts[i].id);
+ if (def->hosts[i].name)
+ virBufferAsprintf(buf, "name='%s' ",
def->hosts[i].name);
+ if (VIR_SOCKET_ADDR_VALID(&def->hosts[i].ip)) {
+ char *ipaddr = virSocketAddrFormat(&def->hosts[i].ip);
if (!ipaddr)
goto error;
virBufferAsprintf(buf, "ip='%s' ", ipaddr);
@@ -2562,7 +2562,8 @@ virNetworkDefFormatInternal(virBufferPtr buf,
{
unsigned char *uuid;
char uuidstr[VIR_UUID_STRING_BUFLEN];
- int ii, shortforward;
+ size_t i;
+ int shortforward;
virBufferAddLit(buf, "<network");
if (!(flags & VIR_NETWORK_XML_INACTIVE) && (def->connections > 0))
{
@@ -2633,21 +2634,21 @@ virNetworkDefFormatInternal(virBufferPtr buf,
if (def->forward.nifs &&
(!def->forward.npfs || !(flags & VIR_NETWORK_XML_INACTIVE))) {
- for (ii = 0; ii < def->forward.nifs; ii++) {
+ for (i = 0; i < def->forward.nifs; i++) {
if (def->forward.type != VIR_NETWORK_FORWARD_HOSTDEV) {
virBufferEscapeString(buf, "<interface
dev='%s'",
- def->forward.ifs[ii].device.dev);
+ def->forward.ifs[i].device.dev);
if (!(flags & VIR_NETWORK_XML_INACTIVE) &&
- (def->forward.ifs[ii].connections > 0)) {
+ (def->forward.ifs[i].connections > 0)) {
virBufferAsprintf(buf, " connections='%d'",
- def->forward.ifs[ii].connections);
+ def->forward.ifs[i].connections);
}
virBufferAddLit(buf, "/>\n");
}
else {
- if (def->forward.ifs[ii].type ==
VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI) {
+ if (def->forward.ifs[i].type ==
VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI) {
if (virDevicePCIAddressFormat(buf,
-
def->forward.ifs[ii].device.pci,
+ def->forward.ifs[i].device.pci,
true) < 0)
goto error;
}
@@ -2692,21 +2693,21 @@ virNetworkDefFormatInternal(virBufferPtr buf,
if (virNetDevBandwidthFormat(def->bandwidth, buf) < 0)
goto error;
- for (ii = 0; ii < def->nips; ii++) {
- if (virNetworkIpDefFormat(buf, &def->ips[ii]) < 0)
+ for (i = 0; i < def->nips; i++) {
+ if (virNetworkIpDefFormat(buf, &def->ips[i]) < 0)
goto error;
}
- for (ii = 0; ii < def->nroutes; ii++) {
- if (virNetworkRouteDefFormat(buf, &def->routes[ii]) < 0)
+ for (i = 0; i < def->nroutes; i++) {
+ if (virNetworkRouteDefFormat(buf, &def->routes[i]) < 0)
goto error;
}
if (virNetDevVPortProfileFormat(def->virtPortProfile, buf) < 0)
goto error;
- for (ii = 0; ii < def->nPortGroups; ii++)
- if (virPortGroupDefFormat(buf, &def->portGroups[ii]) < 0)
+ for (i = 0; i < def->nPortGroups; i++)
+ if (virPortGroupDefFormat(buf, &def->portGroups[i]) < 0)
goto error;
virBufferAdjustIndent(buf, -2);
@@ -2776,14 +2777,14 @@ error:
virPortGroupDefPtr virPortGroupFindByName(virNetworkDefPtr net,
const char *portgroup)
{
- int ii;
- for (ii = 0; ii < net->nPortGroups; ii++) {
+ size_t i;
+ for (i = 0; i < net->nPortGroups; i++) {
if (portgroup) {
- if (STREQ(portgroup, net->portGroups[ii].name))
- return &net->portGroups[ii];
+ if (STREQ(portgroup, net->portGroups[i].name))
+ return &net->portGroups[i];
} else {
- if (net->portGroups[ii].isDefault)
- return &net->portGroups[ii];
+ if (net->portGroups[i].isDefault)
+ return &net->portGroups[i];
}
}
return NULL;
@@ -3133,7 +3134,7 @@ int virNetworkBridgeInUse(const virNetworkObjListPtr nets,
const char *bridge,
const char *skipname)
{
- unsigned int i;
+ size_t i;
unsigned int ret = 0;
for (i = 0; i < nets->count; i++) {
@@ -3289,7 +3290,7 @@ static virNetworkIpDefPtr
virNetworkIpDefByIndex(virNetworkDefPtr def, int parentIndex)
{
virNetworkIpDefPtr ipdef = NULL;
- int ii;
+ size_t i;
/* first find which ip element's dhcp host list to work on */
if (parentIndex >= 0) {
@@ -3306,9 +3307,9 @@ virNetworkIpDefByIndex(virNetworkDefPtr def, int parentIndex)
/* -1 means "find the most appropriate", which in this case
* means the one and only <ip> that has <dhcp> element
*/
- for (ii = 0;
- (ipdef = virNetworkDefGetIpByIndex(def, AF_UNSPEC, ii));
- ii++) {
+ for (i = 0;
+ (ipdef = virNetworkDefGetIpByIndex(def, AF_UNSPEC, i));
+ i++) {
if (ipdef->nranges || ipdef->nhosts)
break;
}
@@ -3333,7 +3334,8 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
/* virNetworkUpdateFlags */
unsigned int fflags ATTRIBUTE_UNUSED)
{
- int ii, ret = -1;
+ size_t i;
+ int ret = -1;
virNetworkIpDefPtr ipdef = virNetworkIpDefByIndex(def, parentIndex);
virNetworkDHCPHostDef host;
@@ -3356,16 +3358,16 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
/* search for the entry with this (mac|name),
* and update the IP+(mac|name) */
- for (ii = 0; ii < ipdef->nhosts; ii++) {
+ for (i = 0; i < ipdef->nhosts; i++) {
if ((host.mac &&
- !virMacAddrCompare(host.mac, ipdef->hosts[ii].mac)) ||
+ !virMacAddrCompare(host.mac, ipdef->hosts[i].mac)) ||
(host.name &&
- STREQ_NULLABLE(host.name, ipdef->hosts[ii].name))) {
+ STREQ_NULLABLE(host.name, ipdef->hosts[i].name))) {
break;
}
}
- if (ii == ipdef->nhosts) {
+ if (i == ipdef->nhosts) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("couldn't locate an existing dhcp host entry with
"
"\"mac='%s'\" in network
'%s'"),
@@ -3377,8 +3379,8 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
* then clear out the extra copy to get rid of the duplicate pointers
* to its data (mac and name strings).
*/
- virNetworkDHCPHostDefClear(&ipdef->hosts[ii]);
- ipdef->hosts[ii] = host;
+ virNetworkDHCPHostDefClear(&ipdef->hosts[i]);
+ ipdef->hosts[i] = host;
memset(&host, 0, sizeof(host));
} else if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
@@ -3390,13 +3392,13 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
}
/* log error if an entry with same name/address/ip already exists */
- for (ii = 0; ii < ipdef->nhosts; ii++) {
+ for (i = 0; i < ipdef->nhosts; i++) {
if ((host.mac &&
- !virMacAddrCompare(host.mac, ipdef->hosts[ii].mac)) ||
+ !virMacAddrCompare(host.mac, ipdef->hosts[i].mac)) ||
(host.name &&
- STREQ_NULLABLE(host.name, ipdef->hosts[ii].name)) ||
+ STREQ_NULLABLE(host.name, ipdef->hosts[i].name)) ||
(VIR_SOCKET_ADDR_VALID(&host.ip) &&
- virSocketAddrEqual(&host.ip, &ipdef->hosts[ii].ip))) {
+ virSocketAddrEqual(&host.ip, &ipdef->hosts[i].ip))) {
char *ip = virSocketAddrFormat(&host.ip);
virReportError(VIR_ERR_OPERATION_INVALID,
@@ -3426,17 +3428,17 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
}
/* find matching entry - all specified attributes must match */
- for (ii = 0; ii < ipdef->nhosts; ii++) {
+ for (i = 0; i < ipdef->nhosts; i++) {
if ((!host.mac ||
- !virMacAddrCompare(host.mac, ipdef->hosts[ii].mac)) &&
+ !virMacAddrCompare(host.mac, ipdef->hosts[i].mac)) &&
(!host.name ||
- STREQ_NULLABLE(host.name, ipdef->hosts[ii].name)) &&
+ STREQ_NULLABLE(host.name, ipdef->hosts[i].name)) &&
(!VIR_SOCKET_ADDR_VALID(&host.ip) ||
- virSocketAddrEqual(&host.ip, &ipdef->hosts[ii].ip))) {
+ virSocketAddrEqual(&host.ip, &ipdef->hosts[i].ip))) {
break;
}
}
- if (ii == ipdef->nhosts) {
+ if (i == ipdef->nhosts) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("couldn't locate a matching dhcp host entry "
"in network '%s'"), def->name);
@@ -3444,8 +3446,8 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
}
/* remove it */
- virNetworkDHCPHostDefClear(&ipdef->hosts[ii]);
- VIR_DELETE_ELEMENT(ipdef->hosts, ii, ipdef->nhosts);
+ virNetworkDHCPHostDefClear(&ipdef->hosts[i]);
+ VIR_DELETE_ELEMENT(ipdef->hosts, i, ipdef->nhosts);
} else {
virNetworkDefUpdateUnknownCommand(command);
@@ -3466,7 +3468,8 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
/* virNetworkUpdateFlags */
unsigned int fflags ATTRIBUTE_UNUSED)
{
- int ii, ret = -1;
+ size_t i;
+ int ret = -1;
virNetworkIpDefPtr ipdef = virNetworkIpDefByIndex(def, parentIndex);
virSocketAddrRange range;
@@ -3492,9 +3495,9 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
goto cleanup;
/* check if an entry with same name/address/ip already exists */
- for (ii = 0; ii < ipdef->nranges; ii++) {
- if (virSocketAddrEqual(&range.start, &ipdef->ranges[ii].start)
&&
- virSocketAddrEqual(&range.end, &ipdef->ranges[ii].end)) {
+ for (i = 0; i < ipdef->nranges; i++) {
+ if (virSocketAddrEqual(&range.start, &ipdef->ranges[i].start)
&&
+ virSocketAddrEqual(&range.end, &ipdef->ranges[i].end)) {
break;
}
}
@@ -3502,7 +3505,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
(command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) {
- if (ii < ipdef->nranges) {
+ if (i < ipdef->nranges) {
char *startip = virSocketAddrFormat(&range.start);
char *endip = virSocketAddrFormat(&range.end);
@@ -3527,7 +3530,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
} else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) {
- if (ii == ipdef->nranges) {
+ if (i == ipdef->nranges) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("couldn't locate a matching dhcp range entry
"
"in network '%s'"), def->name);
@@ -3536,7 +3539,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
/* remove it */
/* NB: nothing to clear from a RangeDef that's being freed */
- VIR_DELETE_ELEMENT(ipdef->ranges, ii, ipdef->nranges);
+ VIR_DELETE_ELEMENT(ipdef->ranges, i, ipdef->nranges);
} else {
virNetworkDefUpdateUnknownCommand(command);
@@ -3568,7 +3571,8 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def,
/* virNetworkUpdateFlags */
unsigned int fflags ATTRIBUTE_UNUSED)
{
- int ii, ret = -1;
+ size_t i;
+ int ret = -1;
virNetworkForwardIfDef iface;
memset(&iface, 0, sizeof(iface));
@@ -3592,17 +3596,17 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def,
}
/* check if an <interface> with same dev name already exists */
- for (ii = 0; ii < def->forward.nifs; ii++) {
- if (def->forward.ifs[ii].type
+ for (i = 0; i < def->forward.nifs; i++) {
+ if (def->forward.ifs[i].type
== VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV &&
- STREQ(iface.device.dev, def->forward.ifs[ii].device.dev))
+ STREQ(iface.device.dev, def->forward.ifs[i].device.dev))
break;
}
if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
(command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) {
- if (ii < def->forward.nifs) {
+ if (i < def->forward.nifs) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("there is an existing interface entry "
"in network '%s' that matches "
@@ -3622,7 +3626,7 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def,
} else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) {
- if (ii == def->forward.nifs) {
+ if (i == def->forward.nifs) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("couldn't find an interface entry "
"in network '%s' matching <interface
dev='%s'>"),
@@ -3631,19 +3635,19 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def,
}
/* fail if the interface is being used */
- if (def->forward.ifs[ii].connections > 0) {
+ if (def->forward.ifs[i].connections > 0) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("unable to delete interface '%s' "
"in network '%s'. It is currently being used
"
" by %d domains."),
iface.device.dev, def->name,
- def->forward.ifs[ii].connections);
+ def->forward.ifs[i].connections);
goto cleanup;
}
/* remove it */
- virNetworkForwardIfDefClear(&def->forward.ifs[ii]);
- VIR_DELETE_ELEMENT(def->forward.ifs, ii, def->forward.nifs);
+ virNetworkForwardIfDefClear(&def->forward.ifs[i]);
+ VIR_DELETE_ELEMENT(def->forward.ifs, i, def->forward.nifs);
} else {
virNetworkDefUpdateUnknownCommand(command);
@@ -3676,7 +3680,8 @@ virNetworkDefUpdatePortGroup(virNetworkDefPtr def,
/* virNetworkUpdateFlags */
unsigned int fflags ATTRIBUTE_UNUSED)
{
- int ii, foundName = -1, foundDefault = -1;
+ size_t i;
+ int foundName = -1, foundDefault = -1;
int ret = -1;
virPortGroupDef portgroup;
@@ -3689,11 +3694,11 @@ virNetworkDefUpdatePortGroup(virNetworkDefPtr def,
goto cleanup;
/* check if a portgroup with same name already exists */
- for (ii = 0; ii < def->nPortGroups; ii++) {
- if (STREQ(portgroup.name, def->portGroups[ii].name))
- foundName = ii;
- if (def->portGroups[ii].isDefault)
- foundDefault = ii;
+ for (i = 0; i < def->nPortGroups; i++) {
+ if (STREQ(portgroup.name, def->portGroups[i].name))
+ foundName = i;
+ if (def->portGroups[i].isDefault)
+ foundDefault = i;
}
if (foundName == -1 &&
((command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) ||
@@ -3772,7 +3777,8 @@ virNetworkDefUpdateDNSHost(virNetworkDefPtr def,
/* virNetworkUpdateFlags */
unsigned int fflags ATTRIBUTE_UNUSED)
{
- int ii, jj, kk, foundIdx = -1, ret = -1;
+ size_t i, j, k;
+ int foundIdx = -1, ret = -1;
virNetworkDNSDefPtr dns = &def->dns;
virNetworkDNSHostDef host;
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
@@ -3794,21 +3800,21 @@ virNetworkDefUpdateDNSHost(virNetworkDefPtr def,
if (virNetworkDNSHostDefParseXML(def->name, ctxt->node, &host, !isAdd) <
0)
goto cleanup;
- for (ii = 0; ii < dns->nhosts; ii++) {
+ for (i = 0; i < dns->nhosts; i++) {
bool foundThisTime = false;
- if (virSocketAddrEqual(&host.ip, &dns->hosts[ii].ip))
+ if (virSocketAddrEqual(&host.ip, &dns->hosts[i].ip))
foundThisTime = true;
- for (jj = 0; jj < host.nnames && !foundThisTime; jj++) {
- for (kk = 0; kk < dns->hosts[ii].nnames && !foundThisTime;
kk++) {
- if (STREQ(host.names[jj], dns->hosts[ii].names[kk]))
+ for (j = 0; j < host.nnames && !foundThisTime; j++) {
+ for (k = 0; k < dns->hosts[i].nnames && !foundThisTime; k++) {
+ if (STREQ(host.names[j], dns->hosts[i].names[k]))
foundThisTime = true;
}
}
if (foundThisTime) {
foundCt++;
- foundIdx = ii;
+ foundIdx = i;
}
}
@@ -3868,7 +3874,8 @@ virNetworkDefUpdateDNSSrv(virNetworkDefPtr def,
/* virNetworkUpdateFlags */
unsigned int fflags ATTRIBUTE_UNUSED)
{
- int ii, foundIdx = -1, ret = -1;
+ size_t i;
+ int foundIdx = -1, ret = -1;
virNetworkDNSDefPtr dns = &def->dns;
virNetworkDNSSrvDef srv;
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
@@ -3890,13 +3897,13 @@ virNetworkDefUpdateDNSSrv(virNetworkDefPtr def,
if (virNetworkDNSSrvDefParseXML(def->name, ctxt->node, ctxt, &srv, !isAdd)
< 0)
goto cleanup;
- for (ii = 0; ii < dns->nsrvs; ii++) {
- if ((!srv.domain || STREQ_NULLABLE(srv.domain, dns->srvs[ii].domain))
&&
- (!srv.service || STREQ_NULLABLE(srv.service, dns->srvs[ii].service))
&&
- (!srv.protocol || STREQ_NULLABLE(srv.protocol, dns->srvs[ii].protocol))
&&
- (!srv.target || STREQ_NULLABLE(srv.target, dns->srvs[ii].target))) {
+ for (i = 0; i < dns->nsrvs; i++) {
+ if ((!srv.domain || STREQ_NULLABLE(srv.domain, dns->srvs[i].domain))
&&
+ (!srv.service || STREQ_NULLABLE(srv.service, dns->srvs[i].service))
&&
+ (!srv.protocol || STREQ_NULLABLE(srv.protocol, dns->srvs[i].protocol))
&&
+ (!srv.target || STREQ_NULLABLE(srv.target, dns->srvs[i].target))) {
foundCt++;
- foundIdx = ii;
+ foundIdx = i;
}
}
@@ -4299,7 +4306,7 @@ virNetworkObjListExport(virConnectPtr conn,
virNetworkPtr net = NULL;
int nnets = 0;
int ret = -1;
- int i;
+ size_t i;
if (nets) {
if (VIR_ALLOC_N(tmp_nets, netobjs.count + 1) < 0) {
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 3209604..bbf071c 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -88,7 +88,7 @@ virNodeDeviceObjPtr
virNodeDeviceFindBySysfsPath(const virNodeDeviceObjListPtr devs,
const char *sysfs_path)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < devs->count; i++) {
virNodeDeviceObjLock(devs->objs[i]);
@@ -106,7 +106,7 @@ virNodeDeviceFindBySysfsPath(const virNodeDeviceObjListPtr devs,
virNodeDeviceObjPtr virNodeDeviceFindByName(const virNodeDeviceObjListPtr devs,
const char *name)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < devs->count; i++) {
virNodeDeviceObjLock(devs->objs[i]);
@@ -158,7 +158,7 @@ void virNodeDeviceObjFree(virNodeDeviceObjPtr dev)
void virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < devs->count; i++)
virNodeDeviceObjFree(devs->objs[i]);
VIR_FREE(devs->objs);
@@ -206,7 +206,7 @@ virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr
devs,
void virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs,
const virNodeDeviceObjPtr dev)
{
- unsigned int i;
+ size_t i;
virNodeDeviceObjUnlock(dev);
@@ -235,7 +235,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
virNodeDevCapsDefPtr caps;
- unsigned int i = 0;
+ size_t i = 0;
virBufferAddLit(&buf, "<device>\n");
virBufferEscapeString(&buf, " <name>%s</name>\n",
def->name);
@@ -569,7 +569,8 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
union _virNodeDevCapData *data)
{
xmlNodePtr orignode, *nodes = NULL;
- int i, n, ret = -1;
+ size_t i;
+ int n, ret = -1;
unsigned long long val;
orignode = ctxt->node;
@@ -989,7 +990,8 @@ virNodeDevCapPciDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr origNode = ctxt->node;
xmlNodePtr *addrNodes = NULL;
char *numberStr = NULL;
- int nAddrNodes, ii, ret = -1;
+ int nAddrNodes, ret = -1;
+ size_t i;
virPCIDeviceAddressPtr pciAddr = NULL;
ctxt->node = iommuGroupNode;
@@ -1011,9 +1013,9 @@ virNodeDevCapPciDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
if ((nAddrNodes = virXPathNodeSet("./address", ctxt, &addrNodes)) <
0)
goto cleanup;
- for (ii = 0; ii < nAddrNodes; ii++) {
+ for (i = 0; i < nAddrNodes; i++) {
virDevicePCIAddress addr = { 0, 0, 0, 0, 0 };
- if (virDevicePCIAddressParseXML(addrNodes[ii], &addr) < 0)
+ if (virDevicePCIAddressParseXML(addrNodes[i], &addr) < 0)
goto cleanup;
if (VIR_ALLOC(pciAddr) < 0) {
virReportOOMError();
@@ -1236,7 +1238,8 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def;
virNodeDevCapsDefPtr *next_cap;
xmlNodePtr *nodes;
- int n, i;
+ int n;
+ size_t i;
if (VIR_ALLOC(def) < 0) {
virReportOOMError();
@@ -1447,7 +1450,7 @@ out:
void virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
{
- int i = 0;
+ size_t i = 0;
union _virNodeDevCapData *data = &caps->data;
switch (caps->type) {
@@ -1604,7 +1607,7 @@ virNodeDeviceObjListExport(virConnectPtr conn,
virNodeDevicePtr device = NULL;
int ndevices = 0;
int ret = -1;
- int i;
+ size_t i;
if (devices) {
if (VIR_ALLOC_N(tmp_devices, devobjs.count + 1) < 0) {
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index b2be99a..068b09d 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -225,7 +225,7 @@ static const char ipsetflags_str[] = "ipsetflags";
static int
intMapGetByInt(const struct int_map *intmap, int32_t attr, const char **res)
{
- int i = 0;
+ size_t i = 0;
bool found = false;
while (intmap[i].val && !found) {
@@ -255,7 +255,7 @@ static int
intMapGetByString(const struct int_map *intmap, const char *str, int casecmp,
int32_t *result)
{
- int i = 0;
+ size_t i = 0;
bool found = false;
while (intmap[i].val && !found) {
@@ -272,7 +272,7 @@ intMapGetByString(const struct int_map *intmap, const char *str, int
casecmp,
void
virNWFilterRuleDefFree(virNWFilterRuleDefPtr def) {
- int i;
+ size_t i;
if (!def)
return;
@@ -312,7 +312,7 @@ virNWFilterEntryFree(virNWFilterEntryPtr entry) {
void
virNWFilterDefFree(virNWFilterDefPtr def) {
- int i;
+ size_t i;
if (!def)
return;
@@ -348,7 +348,7 @@ virNWFilterObjFree(virNWFilterObjPtr obj)
void
virNWFilterObjListFree(virNWFilterObjListPtr nwfilters)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < nwfilters->count; i++)
virNWFilterObjFree(nwfilters->objs[i]);
VIR_FREE(nwfilters->objs);
@@ -361,7 +361,7 @@ virNWFilterRuleDefAddVar(virNWFilterRuleDefPtr nwf,
nwItemDesc *item,
const char *var)
{
- int i = 0;
+ size_t i = 0;
virNWFilterVarAccessPtr varAccess;
varAccess = virNWFilterVarAccessParse(var);
@@ -413,7 +413,7 @@ void
virNWFilterObjRemove(virNWFilterObjListPtr nwfilters,
virNWFilterObjPtr nwfilter)
{
- unsigned int i;
+ size_t i;
virNWFilterObjUnlock(nwfilter);
@@ -789,7 +789,7 @@ parseStringItems(const struct int_map *int_map,
const char *input, int32_t *flags, char sep)
{
int rc = 0;
- unsigned int i, j;
+ size_t i, j;
bool found;
i = 0;
@@ -821,7 +821,8 @@ static int
printStringItems(virBufferPtr buf, const struct int_map *int_map,
int32_t flags, const char *sep)
{
- unsigned int i, c = 0;
+ size_t i;
+ unsigned int c = 0;
int32_t mask = 0x1;
while (mask) {
@@ -2361,7 +2362,7 @@ virNWFilterRuleParse(xmlNodePtr node)
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) {
- int i = 0;
+ size_t i = 0;
while (1) {
if (found)
i = found_i;
@@ -2679,7 +2680,7 @@ virNWFilterObjPtr
virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters,
const unsigned char *uuid)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < nwfilters->count; i++) {
virNWFilterObjLock(nwfilters->objs[i]);
@@ -2695,7 +2696,7 @@ virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters,
virNWFilterObjPtr
virNWFilterObjFindByName(virNWFilterObjListPtr nwfilters, const char *name)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < nwfilters->count; i++) {
virNWFilterObjLock(nwfilters->objs[i]);
@@ -2763,7 +2764,7 @@ _virNWFilterDefLoopDetect(virConnectPtr conn,
const char *filtername)
{
int rc = 0;
- int i;
+ size_t i;
virNWFilterEntryPtr entry;
virNWFilterObjPtr obj;
@@ -2830,7 +2831,7 @@ virNWFilterRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd)
void
virNWFilterUnRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd)
{
- int i = 0;
+ size_t i = 0;
while (i < nCallbackDriver && callbackDrvArray[i] != cbd)
i++;
@@ -2846,7 +2847,7 @@ virNWFilterUnRegisterCallbackDriver(virNWFilterCallbackDriverPtr
cbd)
void
virNWFilterCallbackDriversLock(void)
{
- int i;
+ size_t i;
for (i = 0; i < nCallbackDriver; i++)
callbackDrvArray[i]->vmDriverLock();
@@ -2855,7 +2856,7 @@ virNWFilterCallbackDriversLock(void)
void
virNWFilterCallbackDriversUnlock(void)
{
- int i;
+ size_t i;
for (i = 0; i < nCallbackDriver; i++)
callbackDrvArray[i]->vmDriverUnlock();
@@ -2872,7 +2873,7 @@ static virDomainObjListIterator virNWFilterDomainFWUpdateCB;
int
virNWFilterInstFiltersOnAllVMs(virConnectPtr conn)
{
- int i;
+ size_t i;
struct domUpdateCBStruct cb = {
.conn = conn,
.step = STEP_APPLY_CURRENT,
@@ -2890,7 +2891,7 @@ virNWFilterInstFiltersOnAllVMs(virConnectPtr conn)
static int
virNWFilterTriggerVMFilterRebuild(virConnectPtr conn)
{
- int i;
+ size_t i;
int ret = 0;
struct domUpdateCBStruct cb = {
.conn = conn,
@@ -3216,7 +3217,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
const virXMLAttr2Struct *att,
virNWFilterRuleDefPtr def)
{
- int i = 0, j;
+ size_t i = 0, j;
bool typeShown = false;
bool neverShown = true;
bool asHex;
@@ -3355,7 +3356,7 @@ err_exit:
static char *
virNWFilterRuleDefFormat(virNWFilterRuleDefPtr def)
{
- int i;
+ size_t i;
virBuffer buf = VIR_BUFFER_INITIALIZER;
virBuffer buf2 = VIR_BUFFER_INITIALIZER;
char *data;
@@ -3442,7 +3443,7 @@ virNWFilterDefFormat(virNWFilterDefPtr def)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
char uuid[VIR_UUID_STRING_BUFLEN];
- int i;
+ size_t i;
char *xml;
virBufferAsprintf(&buf, "<filter name='%s'
chain='%s'",
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index 48b89b7..a20b7b0 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -188,7 +188,8 @@ bool
virNWFilterVarValueEqual(const virNWFilterVarValuePtr a,
const virNWFilterVarValuePtr b)
{
- unsigned int card, i, j;
+ unsigned int card;
+ size_t i, j;
const char *s;
if (!a || !b)
@@ -285,7 +286,7 @@ virNWFilterVarValueDelNthValue(virNWFilterVarValuePtr val, unsigned
int pos)
int
virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value)
{
- unsigned int i;
+ size_t i;
switch (val->valType) {
case NWFILTER_VALUE_TYPE_SIMPLE:
@@ -307,7 +308,7 @@ virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char
*value)
void
virNWFilterVarCombIterFree(virNWFilterVarCombIterPtr ci)
{
- unsigned int i;
+ size_t i;
if (!ci)
return;
@@ -322,7 +323,7 @@ static int
virNWFilterVarCombIterGetIndexByIterId(virNWFilterVarCombIterPtr ci,
unsigned int iterId)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < ci->nIter; i++)
if (ci->iter[i].iterId == iterId)
@@ -412,7 +413,7 @@ static bool
virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie,
virNWFilterHashTablePtr hash)
{
- unsigned int i, j;
+ size_t i, j;
virNWFilterVarValuePtr varValue, tmp;
const char *value;
@@ -473,7 +474,8 @@ virNWFilterVarCombIterCreate(virNWFilterHashTablePtr hash,
size_t nVarAccess)
{
virNWFilterVarCombIterPtr res;
- unsigned int i, iterId;
+ size_t i;
+ unsigned int iterId;
int iterIndex = -1;
unsigned int nextIntIterId = VIR_NWFILTER_MAX_ITERID + 1;
@@ -528,7 +530,7 @@ err_exit:
virNWFilterVarCombIterPtr
virNWFilterVarCombIterNext(virNWFilterVarCombIterPtr ci)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < ci->nIter; i++) {
next:
@@ -555,7 +557,8 @@ const char *
virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci,
const virNWFilterVarAccessPtr vap)
{
- unsigned int i, iterId;
+ size_t i;
+ unsigned int iterId;
bool found = false;
const char *res = NULL;
virNWFilterVarValuePtr value;
@@ -687,7 +690,7 @@ virNWFilterHashTablePut(virNWFilterHashTablePtr table,
void
virNWFilterHashTableFree(virNWFilterHashTablePtr table)
{
- int i;
+ size_t i;
if (!table)
return;
virHashFree(table->hashTable);
@@ -720,7 +723,7 @@ void *
virNWFilterHashTableRemoveEntry(virNWFilterHashTablePtr ht,
const char *entry)
{
- int i;
+ size_t i;
void *value = virHashSteal(ht->hashTable, entry);
if (value) {
@@ -903,7 +906,8 @@ virNWFilterFormatParamAttributes(virBufferPtr buf,
const char *filterref)
{
virHashKeyValuePairPtr items;
- int i, j, card, numKeys;
+ size_t i, j;
+ int card, numKeys;
numKeys = virHashSize(table->hashTable);
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index b500111..20c86ff 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -86,7 +86,7 @@ virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDefPtr disk)
void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def)
{
- int i;
+ size_t i;
if (!def)
return;
@@ -178,7 +178,8 @@ virDomainSnapshotDefParseString(const char *xmlStr,
virDomainSnapshotDefPtr def = NULL;
virDomainSnapshotDefPtr ret = NULL;
xmlNodePtr *nodes = NULL;
- int i;
+ size_t i;
+ int n;
char *creation = NULL, *state = NULL;
struct timeval tv;
int active;
@@ -317,10 +318,10 @@ virDomainSnapshotDefParseString(const char *xmlStr,
def->file = memoryFile;
memoryFile = NULL;
- if ((i = virXPathNodeSet("./disks/*", ctxt, &nodes)) < 0)
+ if ((n = virXPathNodeSet("./disks/*", ctxt, &nodes)) < 0)
goto cleanup;
if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_DISKS) {
- def->ndisks = i;
+ def->ndisks = n;
if (def->ndisks && VIR_ALLOC_N(def->disks, def->ndisks) < 0)
{
virReportOOMError();
goto cleanup;
@@ -330,7 +331,7 @@ virDomainSnapshotDefParseString(const char *xmlStr,
goto cleanup;
}
VIR_FREE(nodes);
- } else if (i) {
+ } else if (n) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("unable to handle disk requests in snapshot"));
goto cleanup;
@@ -385,7 +386,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def,
{
int ret = -1;
virBitmapPtr map = NULL;
- int i;
+ size_t i;
int ndisks;
bool inuse;
@@ -581,7 +582,7 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid,
int internal)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
- int i;
+ size_t i;
virCheckFlags(VIR_DOMAIN_XML_SECURE |
VIR_DOMAIN_XML_UPDATE_CPU, NULL);
@@ -784,7 +785,7 @@ virDomainSnapshotObjListGetNames(virDomainSnapshotObjListPtr
snapshots,
{
struct virDomainSnapshotNameData data = { names, maxnames, flags, 0,
false };
- int i;
+ size_t i;
if (!from) {
/* LIST_ROOTS and LIST_DESCENDANTS have the same bit value,
@@ -1026,7 +1027,7 @@ virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotPtr *list = NULL;
char **names;
int ret = -1;
- int i;
+ size_t i;
if (!snaps || count < 0)
return count;
@@ -1062,7 +1063,7 @@ cleanup:
bool
virDomainSnapshotDefIsExternal(virDomainSnapshotDefPtr def)
{
- int i;
+ size_t i;
if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
return true;
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 2539c45..2639f1a 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -264,7 +264,7 @@ static virStoragePoolTypeInfo poolTypeInfo[] = {
static virStoragePoolTypeInfoPtr
virStoragePoolTypeInfoLookup(int type)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < ARRAY_CARDINALITY(poolTypeInfo); i++)
if (poolTypeInfo[i].poolType == type)
return &poolTypeInfo[i];
@@ -296,7 +296,7 @@ virStorageVolOptionsForPoolType(int type)
void
virStorageVolDefFree(virStorageVolDefPtr def)
{
- int i;
+ size_t i;
if (!def)
return;
@@ -338,7 +338,7 @@ virStoragePoolSourceAdapterClear(virStoragePoolSourceAdapter adapter)
void
virStoragePoolSourceClear(virStoragePoolSourcePtr source)
{
- int i;
+ size_t i;
if (!source)
return;
@@ -416,7 +416,7 @@ virStoragePoolObjFree(virStoragePoolObjPtr obj)
void
virStoragePoolObjListFree(virStoragePoolObjListPtr pools)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < pools->count; i++)
virStoragePoolObjFree(pools->objs[i]);
VIR_FREE(pools->objs);
@@ -427,7 +427,7 @@ void
virStoragePoolObjRemove(virStoragePoolObjListPtr pools,
virStoragePoolObjPtr pool)
{
- unsigned int i;
+ size_t i;
virStoragePoolObjUnlock(pool);
@@ -527,7 +527,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
int ret = -1;
xmlNodePtr relnode, *nodeset = NULL;
char *authType = NULL;
- int nsource, i;
+ int nsource;
+ size_t i;
virStoragePoolOptionsPtr options;
char *name = NULL;
char *port = NULL;
@@ -1046,7 +1047,7 @@ virStoragePoolSourceFormat(virBufferPtr buf,
virStoragePoolOptionsPtr options,
virStoragePoolSourcePtr src)
{
- int i, j;
+ size_t i, j;
char uuid[VIR_UUID_STRING_BUFLEN];
virBufferAddLit(buf," <source>\n");
@@ -1261,7 +1262,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
char *unit = NULL;
xmlNodePtr node;
xmlNodePtr *nodes = NULL;
- int i, n;
+ size_t i;
+ int n;
options = virStorageVolOptionsForPoolType(pool->type);
if (options == NULL)
@@ -1535,7 +1537,7 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
virBufferEscapeString(buf, " <compat>%s</compat>\n",
def->compat);
if (options->featureToString && def->features) {
- int i;
+ size_t i;
bool b;
bool empty = virBitmapIsAllClear(def->features);
@@ -1576,7 +1578,7 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
virBufferAddLit(&buf, " <source>\n");
if (def->source.nextent) {
- int i;
+ size_t i;
const char *thispath = NULL;
for (i = 0; i < def->source.nextent; i++) {
if (thispath == NULL ||
@@ -1632,7 +1634,7 @@ virStoragePoolObjPtr
virStoragePoolObjFindByUUID(virStoragePoolObjListPtr pools,
const unsigned char *uuid)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < pools->count; i++) {
virStoragePoolObjLock(pools->objs[i]);
@@ -1648,7 +1650,7 @@ virStoragePoolObjPtr
virStoragePoolObjFindByName(virStoragePoolObjListPtr pools,
const char *name)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < pools->count; i++) {
virStoragePoolObjLock(pools->objs[i]);
@@ -1664,7 +1666,7 @@ virStoragePoolObjPtr
virStoragePoolSourceFindDuplicateDevices(virStoragePoolObjPtr pool,
virStoragePoolDefPtr def)
{
- unsigned int i, j;
+ size_t i, j;
for (i = 0; i < pool->def->source.ndevice; i++) {
for (j = 0; j < def->source.ndevice; j++) {
@@ -1679,7 +1681,7 @@ virStoragePoolSourceFindDuplicateDevices(virStoragePoolObjPtr pool,
void
virStoragePoolObjClearVols(virStoragePoolObjPtr pool)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < pool->volumes.count; i++)
virStorageVolDefFree(pool->volumes.objs[i]);
@@ -1691,7 +1693,7 @@ virStorageVolDefPtr
virStorageVolDefFindByKey(virStoragePoolObjPtr pool,
const char *key)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < pool->volumes.count; i++)
if (STREQ(pool->volumes.objs[i]->key, key))
@@ -1704,7 +1706,7 @@ virStorageVolDefPtr
virStorageVolDefFindByPath(virStoragePoolObjPtr pool,
const char *path)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < pool->volumes.count; i++)
if (STREQ(pool->volumes.objs[i]->target.path, path))
@@ -1717,7 +1719,7 @@ virStorageVolDefPtr
virStorageVolDefFindByName(virStoragePoolObjPtr pool,
const char *name)
{
- unsigned int i;
+ size_t i;
for (i = 0; i < pool->volumes.count; i++)
if (STREQ(pool->volumes.objs[i]->name, name))
@@ -1950,7 +1952,7 @@ virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
virStoragePoolOptionsPtr options;
virBuffer buf = VIR_BUFFER_INITIALIZER;
const char *type;
- int i;
+ size_t i;
options = virStoragePoolOptionsForPoolType(def->type);
if (options == NULL)
@@ -2050,7 +2052,7 @@ int
virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools,
virStoragePoolDefPtr def)
{
- int i;
+ size_t i;
int ret = 1;
virStoragePoolObjPtr pool = NULL;
virStoragePoolObjPtr matchpool = NULL;
@@ -2213,7 +2215,7 @@ virStoragePoolObjListExport(virConnectPtr conn,
virStoragePoolPtr pool = NULL;
int npools = 0;
int ret = -1;
- int i;
+ size_t i;
if (pools) {
if (VIR_ALLOC_N(tmp_pools, poolobjs.count + 1) < 0) {
diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c
index c710bbd..5c912fe 100644
--- a/src/conf/storage_encryption_conf.c
+++ b/src/conf/storage_encryption_conf.c
@@ -132,7 +132,8 @@ virStorageEncryptionParseXML(xmlXPathContextPtr ctxt)
xmlNodePtr *nodes = NULL;
virStorageEncryptionPtr ret;
char *format_str;
- int format, i, n;
+ int format, n;
+ size_t i;
if (VIR_ALLOC(ret) < 0) {
virReportOOMError();
--
1.8.1.4