提交 921d67e0 编写于 作者: D Daniel P. Berrange

Convert 'int i' to 'size_t i' in src/conf/ 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: NDaniel P. Berrange <berrange@redhat.com>
上级 8849fc38
...@@ -123,7 +123,7 @@ virCapabilitiesFreeGuestMachine(virCapsGuestMachinePtr machine) ...@@ -123,7 +123,7 @@ virCapabilitiesFreeGuestMachine(virCapsGuestMachinePtr machine)
static void static void
virCapabilitiesFreeGuestDomain(virCapsGuestDomainPtr dom) virCapabilitiesFreeGuestDomain(virCapsGuestDomainPtr dom)
{ {
int i; size_t i;
if (dom == NULL) if (dom == NULL)
return; return;
...@@ -149,7 +149,7 @@ virCapabilitiesFreeGuestFeature(virCapsGuestFeaturePtr feature) ...@@ -149,7 +149,7 @@ virCapabilitiesFreeGuestFeature(virCapsGuestFeaturePtr feature)
static void static void
virCapabilitiesFreeGuest(virCapsGuestPtr guest) virCapabilitiesFreeGuest(virCapsGuestPtr guest)
{ {
int i; size_t i;
if (guest == NULL) if (guest == NULL)
return; return;
...@@ -175,7 +175,7 @@ virCapabilitiesFreeGuest(virCapsGuestPtr guest) ...@@ -175,7 +175,7 @@ virCapabilitiesFreeGuest(virCapsGuestPtr guest)
void void
virCapabilitiesFreeNUMAInfo(virCapsPtr caps) virCapabilitiesFreeNUMAInfo(virCapsPtr caps)
{ {
int i; size_t i;
for (i = 0; i < caps->host.nnumaCell; i++) for (i = 0; i < caps->host.nnumaCell; i++)
virCapabilitiesFreeHostNUMACell(caps->host.numaCell[i]); virCapabilitiesFreeHostNUMACell(caps->host.numaCell[i]);
...@@ -187,7 +187,7 @@ static void ...@@ -187,7 +187,7 @@ static void
virCapabilitiesDispose(void *object) virCapabilitiesDispose(void *object)
{ {
virCapsPtr caps = object; virCapsPtr caps = object;
int i; size_t i;
for (i = 0; i < caps->nguests; i++) for (i = 0; i < caps->nguests; i++)
virCapabilitiesFreeGuest(caps->guests[i]); virCapabilitiesFreeGuest(caps->guests[i]);
...@@ -327,7 +327,7 @@ virCapsGuestMachinePtr * ...@@ -327,7 +327,7 @@ virCapsGuestMachinePtr *
virCapabilitiesAllocMachines(const char *const *names, int nnames) virCapabilitiesAllocMachines(const char *const *names, int nnames)
{ {
virCapsGuestMachinePtr *machines; virCapsGuestMachinePtr *machines;
int i; size_t i;
if (VIR_ALLOC_N(machines, nnames) < 0) if (VIR_ALLOC_N(machines, nnames) < 0)
return NULL; return NULL;
...@@ -353,7 +353,7 @@ void ...@@ -353,7 +353,7 @@ void
virCapabilitiesFreeMachines(virCapsGuestMachinePtr *machines, virCapabilitiesFreeMachines(virCapsGuestMachinePtr *machines,
int nmachines) int nmachines)
{ {
int i; size_t i;
if (!machines) if (!machines)
return; return;
for (i = 0; i < nmachines && machines[i]; i++) { for (i = 0; i < nmachines && machines[i]; i++) {
...@@ -518,7 +518,7 @@ extern int ...@@ -518,7 +518,7 @@ extern int
virCapabilitiesSupportsGuestArch(virCapsPtr caps, virCapabilitiesSupportsGuestArch(virCapsPtr caps,
virArch arch) virArch arch)
{ {
int i; size_t i;
for (i = 0; i < caps->nguests; i++) { for (i = 0; i < caps->nguests; i++) {
if (caps->guests[i]->arch.id == arch) if (caps->guests[i]->arch.id == arch)
return 1; return 1;
...@@ -539,7 +539,7 @@ extern int ...@@ -539,7 +539,7 @@ extern int
virCapabilitiesSupportsGuestOSType(virCapsPtr caps, virCapabilitiesSupportsGuestOSType(virCapsPtr caps,
const char *ostype) const char *ostype)
{ {
int i; size_t i;
for (i = 0; i < caps->nguests; i++) { for (i = 0; i < caps->nguests; i++) {
if (STREQ(caps->guests[i]->ostype, ostype)) if (STREQ(caps->guests[i]->ostype, ostype))
return 1; return 1;
...@@ -562,7 +562,7 @@ virCapabilitiesSupportsGuestOSTypeArch(virCapsPtr caps, ...@@ -562,7 +562,7 @@ virCapabilitiesSupportsGuestOSTypeArch(virCapsPtr caps,
const char *ostype, const char *ostype,
virArch arch) virArch arch)
{ {
int i; size_t i;
for (i = 0; i < caps->nguests; i++) { for (i = 0; i < caps->nguests; i++) {
if (STREQ(caps->guests[i]->ostype, ostype) && if (STREQ(caps->guests[i]->ostype, ostype) &&
caps->guests[i]->arch.id == arch) caps->guests[i]->arch.id == arch)
...@@ -585,7 +585,7 @@ virCapabilitiesDefaultGuestArch(virCapsPtr caps, ...@@ -585,7 +585,7 @@ virCapabilitiesDefaultGuestArch(virCapsPtr caps,
const char *ostype, const char *ostype,
const char *domain) const char *domain)
{ {
int i, j; size_t i, j;
/* First try to find one matching host arch */ /* First try to find one matching host arch */
for (i = 0; i < caps->nguests; i++) { for (i = 0; i < caps->nguests; i++) {
...@@ -628,11 +628,11 @@ virCapabilitiesDefaultGuestMachine(virCapsPtr caps, ...@@ -628,11 +628,11 @@ virCapabilitiesDefaultGuestMachine(virCapsPtr caps,
virArch arch, virArch arch,
const char *domain) const char *domain)
{ {
int i; size_t i;
for (i = 0; i < caps->nguests; i++) { for (i = 0; i < caps->nguests; i++) {
virCapsGuestPtr guest = caps->guests[i]; virCapsGuestPtr guest = caps->guests[i];
int j; size_t j;
if (!STREQ(guest->ostype, ostype) || if (!STREQ(guest->ostype, ostype) ||
guest->arch.id != arch) guest->arch.id != arch)
...@@ -674,7 +674,7 @@ virCapabilitiesDefaultGuestEmulator(virCapsPtr caps, ...@@ -674,7 +674,7 @@ virCapabilitiesDefaultGuestEmulator(virCapsPtr caps,
virArch arch, virArch arch,
const char *domain) const char *domain)
{ {
int i, j; size_t i, j;
for (i = 0; i < caps->nguests; i++) { for (i = 0; i < caps->nguests; i++) {
char *emulator; char *emulator;
if (STREQ(caps->guests[i]->ostype, ostype) && if (STREQ(caps->guests[i]->ostype, ostype) &&
...@@ -697,8 +697,8 @@ virCapabilitiesFormatNUMATopology(virBufferPtr xml, ...@@ -697,8 +697,8 @@ virCapabilitiesFormatNUMATopology(virBufferPtr xml,
size_t ncells, size_t ncells,
virCapsHostNUMACellPtr *cells) virCapsHostNUMACellPtr *cells)
{ {
int i; size_t i;
int j; size_t j;
char *siblings; char *siblings;
virBufferAddLit(xml, " <topology>\n"); virBufferAddLit(xml, " <topology>\n");
...@@ -754,7 +754,7 @@ char * ...@@ -754,7 +754,7 @@ char *
virCapabilitiesFormatXML(virCapsPtr caps) virCapabilitiesFormatXML(virCapsPtr caps)
{ {
virBuffer xml = VIR_BUFFER_INITIALIZER; virBuffer xml = VIR_BUFFER_INITIALIZER;
int i, j, k; size_t i, j, k;
char host_uuid[VIR_UUID_STRING_BUFLEN]; char host_uuid[VIR_UUID_STRING_BUFLEN];
virBufferAddLit(&xml, "<capabilities>\n\n"); virBufferAddLit(&xml, "<capabilities>\n\n");
......
...@@ -60,7 +60,7 @@ VIR_ENUM_IMPL(virCPUFeaturePolicy, VIR_CPU_FEATURE_LAST, ...@@ -60,7 +60,7 @@ VIR_ENUM_IMPL(virCPUFeaturePolicy, VIR_CPU_FEATURE_LAST,
void ATTRIBUTE_NONNULL(1) void ATTRIBUTE_NONNULL(1)
virCPUDefFreeModel(virCPUDefPtr def) virCPUDefFreeModel(virCPUDefPtr def)
{ {
unsigned int i; size_t i;
VIR_FREE(def->model); VIR_FREE(def->model);
VIR_FREE(def->vendor); VIR_FREE(def->vendor);
...@@ -74,7 +74,7 @@ virCPUDefFreeModel(virCPUDefPtr def) ...@@ -74,7 +74,7 @@ virCPUDefFreeModel(virCPUDefPtr def)
void void
virCPUDefFree(virCPUDefPtr def) virCPUDefFree(virCPUDefPtr def)
{ {
unsigned int i; size_t i;
if (!def) if (!def)
return; return;
...@@ -97,7 +97,7 @@ virCPUDefCopyModel(virCPUDefPtr dst, ...@@ -97,7 +97,7 @@ virCPUDefCopyModel(virCPUDefPtr dst,
const virCPUDefPtr src, const virCPUDefPtr src,
bool resetPolicy) bool resetPolicy)
{ {
unsigned int i; size_t i;
if (VIR_STRDUP(dst->model, src->model) < 0 || if (VIR_STRDUP(dst->model, src->model) < 0 ||
VIR_STRDUP(dst->vendor, src->vendor) < 0 || VIR_STRDUP(dst->vendor, src->vendor) < 0 ||
...@@ -129,7 +129,7 @@ virCPUDefPtr ...@@ -129,7 +129,7 @@ virCPUDefPtr
virCPUDefCopy(const virCPUDefPtr cpu) virCPUDefCopy(const virCPUDefPtr cpu)
{ {
virCPUDefPtr copy; virCPUDefPtr copy;
unsigned int i; size_t i;
if (!cpu || VIR_ALLOC(copy) < 0) if (!cpu || VIR_ALLOC(copy) < 0)
return NULL; return NULL;
...@@ -181,7 +181,7 @@ virCPUDefParseXML(const xmlNodePtr node, ...@@ -181,7 +181,7 @@ virCPUDefParseXML(const xmlNodePtr node,
virCPUDefPtr def; virCPUDefPtr def;
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
int n; int n;
unsigned int i; size_t i;
char *cpuMode; char *cpuMode;
char *fallback = NULL; char *fallback = NULL;
char *vendor_id = NULL; char *vendor_id = NULL;
...@@ -379,7 +379,7 @@ virCPUDefParseXML(const xmlNodePtr node, ...@@ -379,7 +379,7 @@ virCPUDefParseXML(const xmlNodePtr node,
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
char *name; char *name;
int policy; /* enum virDomainCPUFeaturePolicy */ int policy; /* enum virDomainCPUFeaturePolicy */
unsigned int j; size_t j;
if (def->type == VIR_CPU_TYPE_GUEST) { if (def->type == VIR_CPU_TYPE_GUEST) {
char *strpolicy; char *strpolicy;
...@@ -562,7 +562,7 @@ virCPUDefFormatBuf(virBufferPtr buf, ...@@ -562,7 +562,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
virCPUDefPtr def, virCPUDefPtr def,
unsigned int flags) unsigned int flags)
{ {
unsigned int i; size_t i;
bool formatModel; bool formatModel;
bool formatFallback; bool formatFallback;
...@@ -663,7 +663,7 @@ virCPUDefAddFeature(virCPUDefPtr def, ...@@ -663,7 +663,7 @@ virCPUDefAddFeature(virCPUDefPtr def,
const char *name, const char *name,
int policy) int policy)
{ {
int i; size_t i;
for (i = 0; i < def->nfeatures; i++) { for (i = 0; i < def->nfeatures; i++) {
if (STREQ(name, def->features[i].name)) { if (STREQ(name, def->features[i].name)) {
...@@ -694,7 +694,7 @@ virCPUDefIsEqual(virCPUDefPtr src, ...@@ -694,7 +694,7 @@ virCPUDefIsEqual(virCPUDefPtr src,
virCPUDefPtr dst) virCPUDefPtr dst)
{ {
bool identical = false; bool identical = false;
int i; size_t i;
if (!src && !dst) if (!src && !dst)
return true; return true;
......
...@@ -793,7 +793,7 @@ virDomainAuditLifecycle(virDomainObjPtr vm, const char *op, ...@@ -793,7 +793,7 @@ virDomainAuditLifecycle(virDomainObjPtr vm, const char *op,
void void
virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success) virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success)
{ {
int i; size_t i;
for (i = 0; i < vm->def->ndisks; i++) { for (i = 0; i < vm->def->ndisks; i++) {
virDomainDiskDefPtr disk = vm->def->disks[i]; virDomainDiskDefPtr disk = vm->def->disks[i];
...@@ -874,7 +874,7 @@ virDomainAuditSecurityLabel(virDomainObjPtr vm, bool success) ...@@ -874,7 +874,7 @@ virDomainAuditSecurityLabel(virDomainObjPtr vm, bool success)
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
char *vmname; char *vmname;
const char *virt; const char *virt;
int i; size_t i;
virUUIDFormat(vm->def->uuid, uuidstr); virUUIDFormat(vm->def->uuid, uuidstr);
if (!(vmname = virAuditEncode("vm", vm->def->name))) { if (!(vmname = virAuditEncode("vm", vm->def->name))) {
......
此差异已折叠。
...@@ -2342,22 +2342,22 @@ virDomainHostdevRemove(virDomainDefPtr def, size_t i); ...@@ -2342,22 +2342,22 @@ virDomainHostdevRemove(virDomainDefPtr def, size_t i);
int virDomainHostdevFind(virDomainDefPtr def, virDomainHostdevDefPtr match, int virDomainHostdevFind(virDomainDefPtr def, virDomainHostdevDefPtr match,
virDomainHostdevDefPtr *found); virDomainHostdevDefPtr *found);
int virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t ii) int virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t i)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t ii, int val) int virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t i, int val)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
const char *virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def, const char *virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def,
size_t ii) size_t i)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def, int virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def,
size_t ii, const char *address, size_t i, const char *address,
int len, bool setType) int len, bool setType)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
const char *virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def, const char *virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def,
size_t ii) size_t i)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def, int virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def,
size_t ii, const char *network, int len) size_t i, const char *network, int len)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
int virDomainNetGetActualType(virDomainNetDefPtr iface); int virDomainNetGetActualType(virDomainNetDefPtr iface);
......
...@@ -134,7 +134,7 @@ struct _virDomainEvent { ...@@ -134,7 +134,7 @@ struct _virDomainEvent {
static void static void
virDomainEventCallbackListFree(virDomainEventCallbackListPtr list) virDomainEventCallbackListFree(virDomainEventCallbackListPtr list)
{ {
int i; size_t i;
if (!list) if (!list)
return; return;
...@@ -162,7 +162,7 @@ virDomainEventCallbackListRemove(virConnectPtr conn, ...@@ -162,7 +162,7 @@ virDomainEventCallbackListRemove(virConnectPtr conn,
virConnectDomainEventCallback callback) virConnectDomainEventCallback callback)
{ {
int ret = 0; int ret = 0;
int i; size_t i;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback) && if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback) &&
cbList->callbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE && cbList->callbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE &&
...@@ -213,7 +213,7 @@ virDomainEventCallbackListRemoveID(virConnectPtr conn, ...@@ -213,7 +213,7 @@ virDomainEventCallbackListRemoveID(virConnectPtr conn,
int callbackID) int callbackID)
{ {
int ret = 0; int ret = 0;
int i; size_t i;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->callbackID == callbackID && if (cbList->callbacks[i]->callbackID == callbackID &&
cbList->callbacks[i]->conn == conn) { cbList->callbacks[i]->conn == conn) {
...@@ -255,7 +255,7 @@ virDomainEventCallbackListMarkDelete(virConnectPtr conn, ...@@ -255,7 +255,7 @@ virDomainEventCallbackListMarkDelete(virConnectPtr conn,
virConnectDomainEventCallback callback) virConnectDomainEventCallback callback)
{ {
int ret = 0; int ret = 0;
int i; size_t i;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback) && if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback) &&
cbList->callbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE && cbList->callbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE &&
...@@ -281,7 +281,7 @@ virDomainEventCallbackListMarkDeleteID(virConnectPtr conn, ...@@ -281,7 +281,7 @@ virDomainEventCallbackListMarkDeleteID(virConnectPtr conn,
int callbackID) int callbackID)
{ {
int ret = 0; int ret = 0;
int i; size_t i;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->callbackID == callbackID && if (cbList->callbacks[i]->callbackID == callbackID &&
cbList->callbacks[i]->conn == conn) { cbList->callbacks[i]->conn == conn) {
...@@ -304,22 +304,22 @@ static int ...@@ -304,22 +304,22 @@ static int
virDomainEventCallbackListPurgeMarked(virDomainEventCallbackListPtr cbList) virDomainEventCallbackListPurgeMarked(virDomainEventCallbackListPtr cbList)
{ {
int old_count = cbList->count; int old_count = cbList->count;
int i; int n;
for (i = 0; i < cbList->count; i++) { for (n = 0; n < cbList->count; n++) {
if (cbList->callbacks[i]->deleted) { if (cbList->callbacks[n]->deleted) {
virFreeCallback freecb = cbList->callbacks[i]->freecb; virFreeCallback freecb = cbList->callbacks[n]->freecb;
if (freecb) if (freecb)
(*freecb)(cbList->callbacks[i]->opaque); (*freecb)(cbList->callbacks[n]->opaque);
virObjectUnref(cbList->callbacks[i]->conn); virObjectUnref(cbList->callbacks[n]->conn);
VIR_FREE(cbList->callbacks[i]); VIR_FREE(cbList->callbacks[n]);
if (i < (cbList->count - 1)) if (n < (cbList->count - 1))
memmove(cbList->callbacks + i, memmove(cbList->callbacks + n,
cbList->callbacks + i + 1, cbList->callbacks + n + 1,
sizeof(*(cbList->callbacks)) * sizeof(*(cbList->callbacks)) *
(cbList->count - (i + 1))); (cbList->count - (n + 1)));
cbList->count--; cbList->count--;
i--; n--;
} }
} }
if (cbList->count < old_count && if (cbList->count < old_count &&
...@@ -352,7 +352,7 @@ virDomainEventCallbackListAddID(virConnectPtr conn, ...@@ -352,7 +352,7 @@ virDomainEventCallbackListAddID(virConnectPtr conn,
int *callbackID) int *callbackID)
{ {
virDomainEventCallbackPtr event; virDomainEventCallbackPtr event;
int i; size_t i;
int ret = 0; int ret = 0;
/* Check incoming */ /* Check incoming */
...@@ -455,7 +455,7 @@ virDomainEventCallbackListEventID(virConnectPtr conn, ...@@ -455,7 +455,7 @@ virDomainEventCallbackListEventID(virConnectPtr conn,
virDomainEventCallbackListPtr cbList, virDomainEventCallbackListPtr cbList,
int callbackID) int callbackID)
{ {
int i; size_t i;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->deleted) if (cbList->callbacks[i]->deleted)
...@@ -496,7 +496,7 @@ void virDomainEventFree(virDomainEventPtr event) ...@@ -496,7 +496,7 @@ void virDomainEventFree(virDomainEventPtr event)
} }
VIR_FREE(event->data.graphics.authScheme); VIR_FREE(event->data.graphics.authScheme);
if (event->data.graphics.subject) { if (event->data.graphics.subject) {
int i; size_t i;
for (i = 0; i < event->data.graphics.subject->nidentity; 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].type);
VIR_FREE(event->data.graphics.subject->identities[i].name); VIR_FREE(event->data.graphics.subject->identities[i].name);
...@@ -532,7 +532,7 @@ void virDomainEventFree(virDomainEventPtr event) ...@@ -532,7 +532,7 @@ void virDomainEventFree(virDomainEventPtr event)
static void static void
virDomainEventQueueClear(virDomainEventQueuePtr queue) virDomainEventQueueClear(virDomainEventQueuePtr queue)
{ {
int i; size_t i;
if (!queue) if (!queue)
return; return;
...@@ -1345,7 +1345,7 @@ virDomainEventDispatch(virDomainEventPtr event, ...@@ -1345,7 +1345,7 @@ virDomainEventDispatch(virDomainEventPtr event,
virDomainEventDispatchFunc dispatch, virDomainEventDispatchFunc dispatch,
void *opaque) void *opaque)
{ {
int i; size_t i;
/* Cache this now, since we may be dropping the lock, /* Cache this now, since we may be dropping the lock,
and have more callbacks added. We're guaranteed not and have more callbacks added. We're guaranteed not
to have any removed */ to have any removed */
...@@ -1370,7 +1370,7 @@ virDomainEventQueueDispatch(virDomainEventQueuePtr queue, ...@@ -1370,7 +1370,7 @@ virDomainEventQueueDispatch(virDomainEventQueuePtr queue,
virDomainEventDispatchFunc dispatch, virDomainEventDispatchFunc dispatch,
void *opaque) void *opaque)
{ {
int i; size_t i;
for (i = 0; i < queue->count; i++) { for (i = 0; i < queue->count; i++) {
virDomainEventDispatch(queue->events[i], callbacks, dispatch, opaque); virDomainEventDispatch(queue->events[i], callbacks, dispatch, opaque);
......
...@@ -53,7 +53,7 @@ virDomainConfNWFilterTeardown(virDomainNetDefPtr net) { ...@@ -53,7 +53,7 @@ virDomainConfNWFilterTeardown(virDomainNetDefPtr net) {
void void
virDomainConfVMNWFilterTeardown(virDomainObjPtr vm) { virDomainConfVMNWFilterTeardown(virDomainObjPtr vm) {
int i; size_t i;
if (nwfilterDriver != NULL) { if (nwfilterDriver != NULL) {
for (i = 0; i < vm->def->nnets; i++) for (i = 0; i < vm->def->nnets; i++)
......
...@@ -54,12 +54,12 @@ void virInterfaceIpDefFree(virInterfaceIpDefPtr def) { ...@@ -54,12 +54,12 @@ void virInterfaceIpDefFree(virInterfaceIpDefPtr def) {
static static
void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def) { void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def) {
int ii; size_t i;
if (def == NULL) if (def == NULL)
return; return;
for (ii = 0; ii < def->nips; ii++) { for (i = 0; i < def->nips; i++) {
virInterfaceIpDefFree(def->ips[ii]); virInterfaceIpDefFree(def->ips[i]);
} }
VIR_FREE(def->ips); VIR_FREE(def->ips);
VIR_FREE(def->family); VIR_FREE(def->family);
...@@ -69,7 +69,8 @@ void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def) { ...@@ -69,7 +69,8 @@ void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def) {
void virInterfaceDefFree(virInterfaceDefPtr def) void virInterfaceDefFree(virInterfaceDefPtr def)
{ {
int i, pp; size_t i;
int pp;
if (def == NULL) if (def == NULL)
return; return;
...@@ -299,7 +300,8 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def, ...@@ -299,7 +300,8 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
xmlXPathContextPtr ctxt) { xmlXPathContextPtr ctxt) {
xmlNodePtr dhcp; xmlNodePtr dhcp;
xmlNodePtr *ipNodes = NULL; xmlNodePtr *ipNodes = NULL;
int nIpNodes, ii, ret = -1; int nIpNodes, ret = -1;
size_t i;
char *tmp; char *tmp;
tmp = virXPathString("string(./route[1]/@gateway)", ctxt); tmp = virXPathString("string(./route[1]/@gateway)", ctxt);
...@@ -322,14 +324,14 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def, ...@@ -322,14 +324,14 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
goto error; goto error;
def->nips = 0; def->nips = 0;
for (ii = 0; ii < nIpNodes; ii++) { for (i = 0; i < nIpNodes; i++) {
virInterfaceIpDefPtr ip; virInterfaceIpDefPtr ip;
if (VIR_ALLOC(ip) < 0) if (VIR_ALLOC(ip) < 0)
goto error; goto error;
ctxt->node = ipNodes[ii]; ctxt->node = ipNodes[i];
ret = virInterfaceDefParseIp(ip, ctxt); ret = virInterfaceDefParseIp(ip, ctxt);
if (ret != 0) { if (ret != 0) {
virInterfaceIpDefFree(ip); virInterfaceIpDefFree(ip);
...@@ -350,7 +352,8 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def, ...@@ -350,7 +352,8 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
xmlXPathContextPtr ctxt) { xmlXPathContextPtr ctxt) {
xmlNodePtr dhcp, autoconf; xmlNodePtr dhcp, autoconf;
xmlNodePtr *ipNodes = NULL; xmlNodePtr *ipNodes = NULL;
int nIpNodes, ii, ret = -1; int nIpNodes, ret = -1;
size_t i;
char *tmp; char *tmp;
tmp = virXPathString("string(./route[1]/@gateway)", ctxt); tmp = virXPathString("string(./route[1]/@gateway)", ctxt);
...@@ -377,14 +380,14 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def, ...@@ -377,14 +380,14 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
goto error; goto error;
def->nips = 0; def->nips = 0;
for (ii = 0; ii < nIpNodes; ii++) { for (i = 0; i < nIpNodes; i++) {
virInterfaceIpDefPtr ip; virInterfaceIpDefPtr ip;
if (VIR_ALLOC(ip) < 0) if (VIR_ALLOC(ip) < 0)
goto error; goto error;
ctxt->node = ipNodes[ii]; ctxt->node = ipNodes[i];
ret = virInterfaceDefParseIp(ip, ctxt); ret = virInterfaceDefParseIp(ip, ctxt);
if (ret != 0) { if (ret != 0) {
virInterfaceIpDefFree(ip); virInterfaceIpDefFree(ip);
...@@ -475,7 +478,8 @@ virInterfaceDefParseBridge(virInterfaceDefPtr def, ...@@ -475,7 +478,8 @@ virInterfaceDefParseBridge(virInterfaceDefPtr def,
xmlNodePtr *interfaces = NULL; xmlNodePtr *interfaces = NULL;
xmlNodePtr bridge; xmlNodePtr bridge;
virInterfaceDefPtr itf; virInterfaceDefPtr itf;
int nbItf, i; int nbItf;
size_t i;
int ret = 0; int ret = 0;
bridge = ctxt->node; bridge = ctxt->node;
...@@ -515,7 +519,8 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def, ...@@ -515,7 +519,8 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
xmlNodePtr *interfaces = NULL; xmlNodePtr *interfaces = NULL;
xmlNodePtr bond = ctxt->node; xmlNodePtr bond = ctxt->node;
virInterfaceDefPtr itf; virInterfaceDefPtr itf;
int nbItf, i; int nbItf;
size_t i;
int ret = 0; int ret = 0;
nbItf = virXPathNodeSet("./interface", ctxt, &interfaces); nbItf = virXPathNodeSet("./interface", ctxt, &interfaces);
...@@ -858,7 +863,7 @@ virInterfaceDefPtr virInterfaceDefParseFile(const char *filename) ...@@ -858,7 +863,7 @@ virInterfaceDefPtr virInterfaceDefParseFile(const char *filename)
static int static int
virInterfaceBridgeDefFormat(virBufferPtr buf, virInterfaceBridgeDefFormat(virBufferPtr buf,
const virInterfaceDefPtr def, int level) { const virInterfaceDefPtr def, int level) {
int i; size_t i;
int ret = 0; int ret = 0;
virBufferAsprintf(buf, "%*s <bridge", level*2, ""); virBufferAsprintf(buf, "%*s <bridge", level*2, "");
...@@ -883,7 +888,7 @@ virInterfaceBridgeDefFormat(virBufferPtr buf, ...@@ -883,7 +888,7 @@ virInterfaceBridgeDefFormat(virBufferPtr buf,
static int static int
virInterfaceBondDefFormat(virBufferPtr buf, virInterfaceBondDefFormat(virBufferPtr buf,
const virInterfaceDefPtr def, int level) { const virInterfaceDefPtr def, int level) {
int i; size_t i;
int ret = 0; int ret = 0;
virBufferAsprintf(buf, "%*s <bond", level*2, ""); virBufferAsprintf(buf, "%*s <bond", level*2, "");
...@@ -965,43 +970,43 @@ virInterfaceVlanDefFormat(virBufferPtr buf, ...@@ -965,43 +970,43 @@ virInterfaceVlanDefFormat(virBufferPtr buf,
static int static int
virInterfaceProtocolDefFormat(virBufferPtr buf, const virInterfaceDefPtr def, virInterfaceProtocolDefFormat(virBufferPtr buf, const virInterfaceDefPtr def,
int level) { 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", 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, ""); virBufferAsprintf(buf, "%*s <autoconf/>\n", level*2, "");
} }
if (def->protos[pp]->dhcp) { if (def->protos[i]->dhcp) {
if (def->protos[pp]->peerdns == 0) if (def->protos[i]->peerdns == 0)
virBufferAsprintf(buf, "%*s <dhcp peerdns='no'/>\n", virBufferAsprintf(buf, "%*s <dhcp peerdns='no'/>\n",
level*2, ""); level*2, "");
else if (def->protos[pp]->peerdns == 1) else if (def->protos[i]->peerdns == 1)
virBufferAsprintf(buf, "%*s <dhcp peerdns='yes'/>\n", virBufferAsprintf(buf, "%*s <dhcp peerdns='yes'/>\n",
level*2, ""); level*2, "");
else else
virBufferAsprintf(buf, "%*s <dhcp/>\n", level*2, ""); virBufferAsprintf(buf, "%*s <dhcp/>\n", level*2, "");
} }
for (ii = 0; ii < def->protos[pp]->nips; ii++) { for (j = 0; j < def->protos[i]->nips; j++) {
if (def->protos[pp]->ips[ii]->address != NULL) { if (def->protos[i]->ips[j]->address != NULL) {
virBufferAsprintf(buf, "%*s <ip address='%s'", level*2, "", virBufferAsprintf(buf, "%*s <ip address='%s'", level*2, "",
def->protos[pp]->ips[ii]->address); def->protos[i]->ips[j]->address);
if (def->protos[pp]->ips[ii]->prefix != 0) { if (def->protos[i]->ips[j]->prefix != 0) {
virBufferAsprintf(buf, " prefix='%d'", virBufferAsprintf(buf, " prefix='%d'",
def->protos[pp]->ips[ii]->prefix); def->protos[i]->ips[j]->prefix);
} }
virBufferAddLit(buf, "/>\n"); virBufferAddLit(buf, "/>\n");
} }
} }
if (def->protos[pp]->gateway != NULL) { if (def->protos[i]->gateway != NULL) {
virBufferAsprintf(buf, "%*s <route gateway='%s'/>\n", 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, ""); virBufferAsprintf(buf, "%*s </protocol>\n", level*2, "");
...@@ -1153,7 +1158,8 @@ int virInterfaceFindByMACString(const virInterfaceObjListPtr interfaces, ...@@ -1153,7 +1158,8 @@ int virInterfaceFindByMACString(const virInterfaceObjListPtr interfaces,
const char *mac, const char *mac,
virInterfaceObjPtr *matches, int maxmatches) virInterfaceObjPtr *matches, int maxmatches)
{ {
unsigned int i, matchct = 0; size_t i;
unsigned int matchct = 0;
for (i = 0; i < interfaces->count; i++) { for (i = 0; i < interfaces->count; i++) {
...@@ -1177,7 +1183,7 @@ virInterfaceObjPtr virInterfaceFindByName(const virInterfaceObjListPtr ...@@ -1177,7 +1183,7 @@ virInterfaceObjPtr virInterfaceFindByName(const virInterfaceObjListPtr
interfaces, interfaces,
const char *name) const char *name)
{ {
unsigned int i; size_t i;
for (i = 0; i < interfaces->count; i++) { for (i = 0; i < interfaces->count; i++) {
virInterfaceObjLock(interfaces->objs[i]); virInterfaceObjLock(interfaces->objs[i]);
...@@ -1191,7 +1197,7 @@ virInterfaceObjPtr virInterfaceFindByName(const virInterfaceObjListPtr ...@@ -1191,7 +1197,7 @@ virInterfaceObjPtr virInterfaceFindByName(const virInterfaceObjListPtr
void virInterfaceObjListFree(virInterfaceObjListPtr interfaces) void virInterfaceObjListFree(virInterfaceObjListPtr interfaces)
{ {
unsigned int i; size_t i;
for (i = 0; i < interfaces->count; i++) for (i = 0; i < interfaces->count; i++)
virInterfaceObjFree(interfaces->objs[i]); virInterfaceObjFree(interfaces->objs[i]);
...@@ -1204,7 +1210,8 @@ int virInterfaceObjListClone(virInterfaceObjListPtr src, ...@@ -1204,7 +1210,8 @@ int virInterfaceObjListClone(virInterfaceObjListPtr src,
virInterfaceObjListPtr dest) virInterfaceObjListPtr dest)
{ {
int ret = -1; int ret = -1;
unsigned int i, cnt; size_t i;
unsigned int cnt;
if (!src || !dest) if (!src || !dest)
goto cleanup; goto cleanup;
...@@ -1276,7 +1283,7 @@ virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces, ...@@ -1276,7 +1283,7 @@ virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces,
void virInterfaceRemove(virInterfaceObjListPtr interfaces, void virInterfaceRemove(virInterfaceObjListPtr interfaces,
const virInterfaceObjPtr iface) const virInterfaceObjPtr iface)
{ {
unsigned int i; size_t i;
virInterfaceObjUnlock(iface); virInterfaceObjUnlock(iface);
for (i = 0; i < interfaces->count; i++) { for (i = 0; i < interfaces->count; i++) {
......
...@@ -39,7 +39,8 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de ...@@ -39,7 +39,8 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de
const char *trunk = NULL; const char *trunk = NULL;
const char *nativeMode = NULL; const char *nativeMode = NULL;
xmlNodePtr *tagNodes = NULL; xmlNodePtr *tagNodes = NULL;
int nTags, ii; int nTags;
size_t i;
ctxt->node = node; ctxt->node = node;
...@@ -59,10 +60,10 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de ...@@ -59,10 +60,10 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de
def->nativeMode = 0; def->nativeMode = 0;
def->nativeTag = 0; def->nativeTag = 0;
for (ii = 0; ii < nTags; ii++) { for (i = 0; i < nTags; i++) {
unsigned long id; unsigned long id;
ctxt->node = tagNodes[ii]; ctxt->node = tagNodes[i];
if (virXPathULong("string(./@id)", ctxt, &id) < 0) { if (virXPathULong("string(./@id)", ctxt, &id) < 0) {
virReportError(VIR_ERR_XML_ERROR, "%s", virReportError(VIR_ERR_XML_ERROR, "%s",
_("missing or invalid vlan tag id attribute")); _("missing or invalid vlan tag id attribute"));
...@@ -90,7 +91,7 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de ...@@ -90,7 +91,7 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de
VIR_FREE(nativeMode); VIR_FREE(nativeMode);
def->nativeTag = id; def->nativeTag = id;
} }
def->tag[ii] = id; def->tag[i] = id;
} }
def->nTags = nTags; def->nTags = nTags;
...@@ -141,7 +142,7 @@ cleanup: ...@@ -141,7 +142,7 @@ cleanup:
int int
virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf) virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf)
{ {
int ii; size_t i;
if (def->nTags == 0) if (def->nTags == 0)
return 0; return 0;
...@@ -153,9 +154,9 @@ virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf) ...@@ -153,9 +154,9 @@ virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf)
} }
virBufferAsprintf(buf, "<vlan%s>\n", def->trunk ? " trunk='yes'" : ""); 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 && 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'/>*/ /* check the nativeMode in case we get <tag id='0'/>*/
const char *mode = virNativeVlanModeTypeToString(def->nativeMode); const char *mode = virNativeVlanModeTypeToString(def->nativeMode);
if (!mode) { if (!mode) {
...@@ -163,9 +164,9 @@ virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf) ...@@ -163,9 +164,9 @@ virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf)
_("Bad value for nativeMode")); _("Bad value for nativeMode"));
} }
virBufferAsprintf(buf, " <tag id='%u' nativeMode='%s'/>\n", virBufferAsprintf(buf, " <tag id='%u' nativeMode='%s'/>\n",
def->tag[ii], mode); def->tag[i], mode);
} else { } else {
virBufferAsprintf(buf, " <tag id='%u'/>\n", def->tag[ii]); virBufferAsprintf(buf, " <tag id='%u'/>\n", def->tag[i]);
} }
} }
virBufferAddLit(buf, "</vlan>\n"); virBufferAddLit(buf, "</vlan>\n");
......
此差异已折叠。
...@@ -88,7 +88,7 @@ virNodeDeviceObjPtr ...@@ -88,7 +88,7 @@ virNodeDeviceObjPtr
virNodeDeviceFindBySysfsPath(const virNodeDeviceObjListPtr devs, virNodeDeviceFindBySysfsPath(const virNodeDeviceObjListPtr devs,
const char *sysfs_path) const char *sysfs_path)
{ {
unsigned int i; size_t i;
for (i = 0; i < devs->count; i++) { for (i = 0; i < devs->count; i++) {
virNodeDeviceObjLock(devs->objs[i]); virNodeDeviceObjLock(devs->objs[i]);
...@@ -106,7 +106,7 @@ virNodeDeviceFindBySysfsPath(const virNodeDeviceObjListPtr devs, ...@@ -106,7 +106,7 @@ virNodeDeviceFindBySysfsPath(const virNodeDeviceObjListPtr devs,
virNodeDeviceObjPtr virNodeDeviceFindByName(const virNodeDeviceObjListPtr devs, virNodeDeviceObjPtr virNodeDeviceFindByName(const virNodeDeviceObjListPtr devs,
const char *name) const char *name)
{ {
unsigned int i; size_t i;
for (i = 0; i < devs->count; i++) { for (i = 0; i < devs->count; i++) {
virNodeDeviceObjLock(devs->objs[i]); virNodeDeviceObjLock(devs->objs[i]);
...@@ -158,7 +158,7 @@ void virNodeDeviceObjFree(virNodeDeviceObjPtr dev) ...@@ -158,7 +158,7 @@ void virNodeDeviceObjFree(virNodeDeviceObjPtr dev)
void virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs) void virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs)
{ {
unsigned int i; size_t i;
for (i = 0; i < devs->count; i++) for (i = 0; i < devs->count; i++)
virNodeDeviceObjFree(devs->objs[i]); virNodeDeviceObjFree(devs->objs[i]);
VIR_FREE(devs->objs); VIR_FREE(devs->objs);
...@@ -203,7 +203,7 @@ virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs, ...@@ -203,7 +203,7 @@ virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
void virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs, void virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs,
const virNodeDeviceObjPtr dev) const virNodeDeviceObjPtr dev)
{ {
unsigned int i; size_t i;
virNodeDeviceObjUnlock(dev); virNodeDeviceObjUnlock(dev);
...@@ -232,7 +232,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def) ...@@ -232,7 +232,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
virNodeDevCapsDefPtr caps; virNodeDevCapsDefPtr caps;
unsigned int i = 0; size_t i = 0;
virBufferAddLit(&buf, "<device>\n"); virBufferAddLit(&buf, "<device>\n");
virBufferEscapeString(&buf, " <name>%s</name>\n", def->name); virBufferEscapeString(&buf, " <name>%s</name>\n", def->name);
...@@ -566,7 +566,8 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, ...@@ -566,7 +566,8 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
union _virNodeDevCapData *data) union _virNodeDevCapData *data)
{ {
xmlNodePtr orignode, *nodes = NULL; xmlNodePtr orignode, *nodes = NULL;
int i, n, ret = -1; size_t i;
int n, ret = -1;
unsigned long long val; unsigned long long val;
orignode = ctxt->node; orignode = ctxt->node;
...@@ -735,7 +736,8 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt, ...@@ -735,7 +736,8 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt,
const char *virt_type) const char *virt_type)
{ {
xmlNodePtr orignode, *nodes = NULL; xmlNodePtr orignode, *nodes = NULL;
int ret = -1, n = 0, i; int ret = -1, n = 0;
size_t i;
char *type = NULL; char *type = NULL;
orignode = ctxt->node; orignode = ctxt->node;
...@@ -986,7 +988,8 @@ virNodeDevCapPciDevIommuGroupParseXML(xmlXPathContextPtr ctxt, ...@@ -986,7 +988,8 @@ virNodeDevCapPciDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr origNode = ctxt->node; xmlNodePtr origNode = ctxt->node;
xmlNodePtr *addrNodes = NULL; xmlNodePtr *addrNodes = NULL;
char *numberStr = NULL; char *numberStr = NULL;
int nAddrNodes, ii, ret = -1; int nAddrNodes, ret = -1;
size_t i;
virPCIDeviceAddressPtr pciAddr = NULL; virPCIDeviceAddressPtr pciAddr = NULL;
ctxt->node = iommuGroupNode; ctxt->node = iommuGroupNode;
...@@ -1008,9 +1011,9 @@ virNodeDevCapPciDevIommuGroupParseXML(xmlXPathContextPtr ctxt, ...@@ -1008,9 +1011,9 @@ virNodeDevCapPciDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
if ((nAddrNodes = virXPathNodeSet("./address", ctxt, &addrNodes)) < 0) if ((nAddrNodes = virXPathNodeSet("./address", ctxt, &addrNodes)) < 0)
goto cleanup; goto cleanup;
for (ii = 0; ii < nAddrNodes; ii++) { for (i = 0; i < nAddrNodes; i++) {
virDevicePCIAddress addr = { 0, 0, 0, 0, 0 }; virDevicePCIAddress addr = { 0, 0, 0, 0, 0 };
if (virDevicePCIAddressParseXML(addrNodes[ii], &addr) < 0) if (virDevicePCIAddressParseXML(addrNodes[i], &addr) < 0)
goto cleanup; goto cleanup;
if (VIR_ALLOC(pciAddr) < 0) if (VIR_ALLOC(pciAddr) < 0)
goto cleanup; goto cleanup;
...@@ -1227,7 +1230,8 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, ...@@ -1227,7 +1230,8 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def; virNodeDeviceDefPtr def;
virNodeDevCapsDefPtr *next_cap; virNodeDevCapsDefPtr *next_cap;
xmlNodePtr *nodes; xmlNodePtr *nodes;
int n, i; int n;
size_t i;
if (VIR_ALLOC(def) < 0) if (VIR_ALLOC(def) < 0)
return NULL; return NULL;
...@@ -1436,7 +1440,7 @@ out: ...@@ -1436,7 +1440,7 @@ out:
void virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) void virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
{ {
int i = 0; size_t i = 0;
union _virNodeDevCapData *data = &caps->data; union _virNodeDevCapData *data = &caps->data;
switch (caps->type) { switch (caps->type) {
...@@ -1593,7 +1597,7 @@ virNodeDeviceObjListExport(virConnectPtr conn, ...@@ -1593,7 +1597,7 @@ virNodeDeviceObjListExport(virConnectPtr conn,
virNodeDevicePtr device = NULL; virNodeDevicePtr device = NULL;
int ndevices = 0; int ndevices = 0;
int ret = -1; int ret = -1;
int i; size_t i;
if (devices && VIR_ALLOC_N(tmp_devices, devobjs.count + 1) < 0) if (devices && VIR_ALLOC_N(tmp_devices, devobjs.count + 1) < 0)
goto cleanup; goto cleanup;
......
...@@ -225,7 +225,7 @@ static const char ipsetflags_str[] = "ipsetflags"; ...@@ -225,7 +225,7 @@ static const char ipsetflags_str[] = "ipsetflags";
static int static int
intMapGetByInt(const struct int_map *intmap, int32_t attr, const char **res) intMapGetByInt(const struct int_map *intmap, int32_t attr, const char **res)
{ {
int i = 0; size_t i = 0;
bool found = false; bool found = false;
while (intmap[i].val && !found) { while (intmap[i].val && !found) {
...@@ -255,7 +255,7 @@ static int ...@@ -255,7 +255,7 @@ static int
intMapGetByString(const struct int_map *intmap, const char *str, int casecmp, intMapGetByString(const struct int_map *intmap, const char *str, int casecmp,
int32_t *result) int32_t *result)
{ {
int i = 0; size_t i = 0;
bool found = false; bool found = false;
while (intmap[i].val && !found) { while (intmap[i].val && !found) {
...@@ -272,7 +272,7 @@ intMapGetByString(const struct int_map *intmap, const char *str, int casecmp, ...@@ -272,7 +272,7 @@ intMapGetByString(const struct int_map *intmap, const char *str, int casecmp,
void void
virNWFilterRuleDefFree(virNWFilterRuleDefPtr def) { virNWFilterRuleDefFree(virNWFilterRuleDefPtr def) {
int i; size_t i;
if (!def) if (!def)
return; return;
...@@ -312,7 +312,7 @@ virNWFilterEntryFree(virNWFilterEntryPtr entry) { ...@@ -312,7 +312,7 @@ virNWFilterEntryFree(virNWFilterEntryPtr entry) {
void void
virNWFilterDefFree(virNWFilterDefPtr def) { virNWFilterDefFree(virNWFilterDefPtr def) {
int i; size_t i;
if (!def) if (!def)
return; return;
...@@ -348,7 +348,7 @@ virNWFilterObjFree(virNWFilterObjPtr obj) ...@@ -348,7 +348,7 @@ virNWFilterObjFree(virNWFilterObjPtr obj)
void void
virNWFilterObjListFree(virNWFilterObjListPtr nwfilters) virNWFilterObjListFree(virNWFilterObjListPtr nwfilters)
{ {
unsigned int i; size_t i;
for (i = 0; i < nwfilters->count; i++) for (i = 0; i < nwfilters->count; i++)
virNWFilterObjFree(nwfilters->objs[i]); virNWFilterObjFree(nwfilters->objs[i]);
VIR_FREE(nwfilters->objs); VIR_FREE(nwfilters->objs);
...@@ -361,7 +361,7 @@ virNWFilterRuleDefAddVar(virNWFilterRuleDefPtr nwf, ...@@ -361,7 +361,7 @@ virNWFilterRuleDefAddVar(virNWFilterRuleDefPtr nwf,
nwItemDesc *item, nwItemDesc *item,
const char *var) const char *var)
{ {
int i = 0; size_t i = 0;
virNWFilterVarAccessPtr varAccess; virNWFilterVarAccessPtr varAccess;
varAccess = virNWFilterVarAccessParse(var); varAccess = virNWFilterVarAccessParse(var);
...@@ -410,7 +410,7 @@ void ...@@ -410,7 +410,7 @@ void
virNWFilterObjRemove(virNWFilterObjListPtr nwfilters, virNWFilterObjRemove(virNWFilterObjListPtr nwfilters,
virNWFilterObjPtr nwfilter) virNWFilterObjPtr nwfilter)
{ {
unsigned int i; size_t i;
virNWFilterObjUnlock(nwfilter); virNWFilterObjUnlock(nwfilter);
...@@ -786,7 +786,7 @@ parseStringItems(const struct int_map *int_map, ...@@ -786,7 +786,7 @@ parseStringItems(const struct int_map *int_map,
const char *input, int32_t *flags, char sep) const char *input, int32_t *flags, char sep)
{ {
int rc = 0; int rc = 0;
unsigned int i, j; size_t i, j;
bool found; bool found;
i = 0; i = 0;
...@@ -818,7 +818,8 @@ static int ...@@ -818,7 +818,8 @@ static int
printStringItems(virBufferPtr buf, const struct int_map *int_map, printStringItems(virBufferPtr buf, const struct int_map *int_map,
int32_t flags, const char *sep) int32_t flags, const char *sep)
{ {
unsigned int i, c = 0; size_t i;
unsigned int c = 0;
int32_t mask = 0x1; int32_t mask = 0x1;
while (mask) { while (mask) {
...@@ -2354,7 +2355,7 @@ virNWFilterRuleParse(xmlNodePtr node) ...@@ -2354,7 +2355,7 @@ virNWFilterRuleParse(xmlNodePtr node)
while (cur != NULL) { while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) { if (cur->type == XML_ELEMENT_NODE) {
int i = 0; size_t i = 0;
while (1) { while (1) {
if (found) if (found)
i = found_i; i = found_i;
...@@ -2667,7 +2668,7 @@ virNWFilterObjPtr ...@@ -2667,7 +2668,7 @@ virNWFilterObjPtr
virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters, virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters,
const unsigned char *uuid) const unsigned char *uuid)
{ {
unsigned int i; size_t i;
for (i = 0; i < nwfilters->count; i++) { for (i = 0; i < nwfilters->count; i++) {
virNWFilterObjLock(nwfilters->objs[i]); virNWFilterObjLock(nwfilters->objs[i]);
...@@ -2683,7 +2684,7 @@ virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters, ...@@ -2683,7 +2684,7 @@ virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters,
virNWFilterObjPtr virNWFilterObjPtr
virNWFilterObjFindByName(virNWFilterObjListPtr nwfilters, const char *name) virNWFilterObjFindByName(virNWFilterObjListPtr nwfilters, const char *name)
{ {
unsigned int i; size_t i;
for (i = 0; i < nwfilters->count; i++) { for (i = 0; i < nwfilters->count; i++) {
virNWFilterObjLock(nwfilters->objs[i]); virNWFilterObjLock(nwfilters->objs[i]);
...@@ -2751,7 +2752,7 @@ _virNWFilterDefLoopDetect(virConnectPtr conn, ...@@ -2751,7 +2752,7 @@ _virNWFilterDefLoopDetect(virConnectPtr conn,
const char *filtername) const char *filtername)
{ {
int rc = 0; int rc = 0;
int i; size_t i;
virNWFilterEntryPtr entry; virNWFilterEntryPtr entry;
virNWFilterObjPtr obj; virNWFilterObjPtr obj;
...@@ -2818,7 +2819,7 @@ virNWFilterRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd) ...@@ -2818,7 +2819,7 @@ virNWFilterRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd)
void void
virNWFilterUnRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd) virNWFilterUnRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd)
{ {
int i = 0; size_t i = 0;
while (i < nCallbackDriver && callbackDrvArray[i] != cbd) while (i < nCallbackDriver && callbackDrvArray[i] != cbd)
i++; i++;
...@@ -2834,7 +2835,7 @@ virNWFilterUnRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd) ...@@ -2834,7 +2835,7 @@ virNWFilterUnRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd)
void void
virNWFilterCallbackDriversLock(void) virNWFilterCallbackDriversLock(void)
{ {
int i; size_t i;
for (i = 0; i < nCallbackDriver; i++) for (i = 0; i < nCallbackDriver; i++)
callbackDrvArray[i]->vmDriverLock(); callbackDrvArray[i]->vmDriverLock();
...@@ -2843,7 +2844,7 @@ virNWFilterCallbackDriversLock(void) ...@@ -2843,7 +2844,7 @@ virNWFilterCallbackDriversLock(void)
void void
virNWFilterCallbackDriversUnlock(void) virNWFilterCallbackDriversUnlock(void)
{ {
int i; size_t i;
for (i = 0; i < nCallbackDriver; i++) for (i = 0; i < nCallbackDriver; i++)
callbackDrvArray[i]->vmDriverUnlock(); callbackDrvArray[i]->vmDriverUnlock();
...@@ -2860,7 +2861,7 @@ static virDomainObjListIterator virNWFilterDomainFWUpdateCB; ...@@ -2860,7 +2861,7 @@ static virDomainObjListIterator virNWFilterDomainFWUpdateCB;
int int
virNWFilterInstFiltersOnAllVMs(virConnectPtr conn) virNWFilterInstFiltersOnAllVMs(virConnectPtr conn)
{ {
int i; size_t i;
struct domUpdateCBStruct cb = { struct domUpdateCBStruct cb = {
.conn = conn, .conn = conn,
.step = STEP_APPLY_CURRENT, .step = STEP_APPLY_CURRENT,
...@@ -2878,7 +2879,7 @@ virNWFilterInstFiltersOnAllVMs(virConnectPtr conn) ...@@ -2878,7 +2879,7 @@ virNWFilterInstFiltersOnAllVMs(virConnectPtr conn)
static int static int
virNWFilterTriggerVMFilterRebuild(virConnectPtr conn) virNWFilterTriggerVMFilterRebuild(virConnectPtr conn)
{ {
int i; size_t i;
int ret = 0; int ret = 0;
struct domUpdateCBStruct cb = { struct domUpdateCBStruct cb = {
.conn = conn, .conn = conn,
...@@ -3201,7 +3202,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf, ...@@ -3201,7 +3202,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
const virXMLAttr2Struct *att, const virXMLAttr2Struct *att,
virNWFilterRuleDefPtr def) virNWFilterRuleDefPtr def)
{ {
int i = 0, j; size_t i = 0, j;
bool typeShown = false; bool typeShown = false;
bool neverShown = true; bool neverShown = true;
bool asHex; bool asHex;
...@@ -3340,7 +3341,7 @@ err_exit: ...@@ -3340,7 +3341,7 @@ err_exit:
static char * static char *
virNWFilterRuleDefFormat(virNWFilterRuleDefPtr def) virNWFilterRuleDefFormat(virNWFilterRuleDefPtr def)
{ {
int i; size_t i;
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
virBuffer buf2 = VIR_BUFFER_INITIALIZER; virBuffer buf2 = VIR_BUFFER_INITIALIZER;
char *data; char *data;
...@@ -3427,7 +3428,7 @@ virNWFilterDefFormat(virNWFilterDefPtr def) ...@@ -3427,7 +3428,7 @@ virNWFilterDefFormat(virNWFilterDefPtr def)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
char uuid[VIR_UUID_STRING_BUFLEN]; char uuid[VIR_UUID_STRING_BUFLEN];
int i; size_t i;
char *xml; char *xml;
virBufferAsprintf(&buf, "<filter name='%s' chain='%s'", virBufferAsprintf(&buf, "<filter name='%s' chain='%s'",
......
...@@ -44,7 +44,7 @@ static unsigned int virNWFilterVarAccessGetIntIterId( ...@@ -44,7 +44,7 @@ static unsigned int virNWFilterVarAccessGetIntIterId(
void void
virNWFilterVarValueFree(virNWFilterVarValuePtr val) virNWFilterVarValueFree(virNWFilterVarValuePtr val)
{ {
unsigned i; size_t i;
if (!val) if (!val)
return; return;
...@@ -68,7 +68,7 @@ virNWFilterVarValuePtr ...@@ -68,7 +68,7 @@ virNWFilterVarValuePtr
virNWFilterVarValueCopy(const virNWFilterVarValuePtr val) virNWFilterVarValueCopy(const virNWFilterVarValuePtr val)
{ {
virNWFilterVarValuePtr res; virNWFilterVarValuePtr res;
unsigned i; size_t i;
char *str; char *str;
if (VIR_ALLOC(res) < 0) if (VIR_ALLOC(res) < 0)
...@@ -183,7 +183,8 @@ bool ...@@ -183,7 +183,8 @@ bool
virNWFilterVarValueEqual(const virNWFilterVarValuePtr a, virNWFilterVarValueEqual(const virNWFilterVarValuePtr a,
const virNWFilterVarValuePtr b) const virNWFilterVarValuePtr b)
{ {
unsigned int card, i, j; unsigned int card;
size_t i, j;
const char *s; const char *s;
if (!a || !b) if (!a || !b)
...@@ -277,7 +278,7 @@ virNWFilterVarValueDelNthValue(virNWFilterVarValuePtr val, unsigned int pos) ...@@ -277,7 +278,7 @@ virNWFilterVarValueDelNthValue(virNWFilterVarValuePtr val, unsigned int pos)
int int
virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value) virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value)
{ {
unsigned int i; size_t i;
switch (val->valType) { switch (val->valType) {
case NWFILTER_VALUE_TYPE_SIMPLE: case NWFILTER_VALUE_TYPE_SIMPLE:
...@@ -299,7 +300,7 @@ virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value) ...@@ -299,7 +300,7 @@ virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value)
void void
virNWFilterVarCombIterFree(virNWFilterVarCombIterPtr ci) virNWFilterVarCombIterFree(virNWFilterVarCombIterPtr ci)
{ {
unsigned int i; size_t i;
if (!ci) if (!ci)
return; return;
...@@ -314,7 +315,7 @@ static int ...@@ -314,7 +315,7 @@ static int
virNWFilterVarCombIterGetIndexByIterId(virNWFilterVarCombIterPtr ci, virNWFilterVarCombIterGetIndexByIterId(virNWFilterVarCombIterPtr ci,
unsigned int iterId) unsigned int iterId)
{ {
unsigned int i; size_t i;
for (i = 0; i < ci->nIter; i++) for (i = 0; i < ci->nIter; i++)
if (ci->iter[i].iterId == iterId) if (ci->iter[i].iterId == iterId)
...@@ -402,7 +403,7 @@ static bool ...@@ -402,7 +403,7 @@ static bool
virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie, virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie,
virNWFilterHashTablePtr hash) virNWFilterHashTablePtr hash)
{ {
unsigned int i, j; size_t i, j;
virNWFilterVarValuePtr varValue, tmp; virNWFilterVarValuePtr varValue, tmp;
const char *value; const char *value;
...@@ -463,7 +464,8 @@ virNWFilterVarCombIterCreate(virNWFilterHashTablePtr hash, ...@@ -463,7 +464,8 @@ virNWFilterVarCombIterCreate(virNWFilterHashTablePtr hash,
size_t nVarAccess) size_t nVarAccess)
{ {
virNWFilterVarCombIterPtr res; virNWFilterVarCombIterPtr res;
unsigned int i, iterId; size_t i;
unsigned int iterId;
int iterIndex = -1; int iterIndex = -1;
unsigned int nextIntIterId = VIR_NWFILTER_MAX_ITERID + 1; unsigned int nextIntIterId = VIR_NWFILTER_MAX_ITERID + 1;
...@@ -516,7 +518,7 @@ err_exit: ...@@ -516,7 +518,7 @@ err_exit:
virNWFilterVarCombIterPtr virNWFilterVarCombIterPtr
virNWFilterVarCombIterNext(virNWFilterVarCombIterPtr ci) virNWFilterVarCombIterNext(virNWFilterVarCombIterPtr ci)
{ {
unsigned int i; size_t i;
for (i = 0; i < ci->nIter; i++) { for (i = 0; i < ci->nIter; i++) {
next: next:
...@@ -543,7 +545,8 @@ const char * ...@@ -543,7 +545,8 @@ const char *
virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci, virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci,
const virNWFilterVarAccessPtr vap) const virNWFilterVarAccessPtr vap)
{ {
unsigned int i, iterId; size_t i;
unsigned int iterId;
bool found = false; bool found = false;
const char *res = NULL; const char *res = NULL;
virNWFilterVarValuePtr value; virNWFilterVarValuePtr value;
...@@ -675,7 +678,7 @@ virNWFilterHashTablePut(virNWFilterHashTablePtr table, ...@@ -675,7 +678,7 @@ virNWFilterHashTablePut(virNWFilterHashTablePtr table,
void void
virNWFilterHashTableFree(virNWFilterHashTablePtr table) virNWFilterHashTableFree(virNWFilterHashTablePtr table)
{ {
int i; size_t i;
if (!table) if (!table)
return; return;
virHashFree(table->hashTable); virHashFree(table->hashTable);
...@@ -706,7 +709,7 @@ void * ...@@ -706,7 +709,7 @@ void *
virNWFilterHashTableRemoveEntry(virNWFilterHashTablePtr ht, virNWFilterHashTableRemoveEntry(virNWFilterHashTablePtr ht,
const char *entry) const char *entry)
{ {
int i; size_t i;
void *value = virHashSteal(ht->hashTable, entry); void *value = virHashSteal(ht->hashTable, entry);
if (value) { if (value) {
...@@ -886,7 +889,8 @@ virNWFilterFormatParamAttributes(virBufferPtr buf, ...@@ -886,7 +889,8 @@ virNWFilterFormatParamAttributes(virBufferPtr buf,
const char *filterref) const char *filterref)
{ {
virHashKeyValuePairPtr items; virHashKeyValuePairPtr items;
int i, j, card, numKeys; size_t i, j;
int card, numKeys;
numKeys = virHashSize(table->hashTable); numKeys = virHashSize(table->hashTable);
......
...@@ -86,7 +86,7 @@ virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDefPtr disk) ...@@ -86,7 +86,7 @@ virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDefPtr disk)
void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def) void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def)
{ {
int i; size_t i;
if (!def) if (!def)
return; return;
...@@ -178,7 +178,8 @@ virDomainSnapshotDefParseString(const char *xmlStr, ...@@ -178,7 +178,8 @@ virDomainSnapshotDefParseString(const char *xmlStr,
virDomainSnapshotDefPtr def = NULL; virDomainSnapshotDefPtr def = NULL;
virDomainSnapshotDefPtr ret = NULL; virDomainSnapshotDefPtr ret = NULL;
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
int i; size_t i;
int n;
char *creation = NULL, *state = NULL; char *creation = NULL, *state = NULL;
struct timeval tv; struct timeval tv;
int active; int active;
...@@ -313,10 +314,10 @@ virDomainSnapshotDefParseString(const char *xmlStr, ...@@ -313,10 +314,10 @@ virDomainSnapshotDefParseString(const char *xmlStr,
def->file = memoryFile; def->file = memoryFile;
memoryFile = NULL; memoryFile = NULL;
if ((i = virXPathNodeSet("./disks/*", ctxt, &nodes)) < 0) if ((n = virXPathNodeSet("./disks/*", ctxt, &nodes)) < 0)
goto cleanup; goto cleanup;
if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_DISKS) { if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_DISKS) {
def->ndisks = i; def->ndisks = n;
if (def->ndisks && VIR_ALLOC_N(def->disks, def->ndisks) < 0) if (def->ndisks && VIR_ALLOC_N(def->disks, def->ndisks) < 0)
goto cleanup; goto cleanup;
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
...@@ -324,7 +325,7 @@ virDomainSnapshotDefParseString(const char *xmlStr, ...@@ -324,7 +325,7 @@ virDomainSnapshotDefParseString(const char *xmlStr,
goto cleanup; goto cleanup;
} }
VIR_FREE(nodes); VIR_FREE(nodes);
} else if (i) { } else if (n) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("unable to handle disk requests in snapshot")); _("unable to handle disk requests in snapshot"));
goto cleanup; goto cleanup;
...@@ -379,7 +380,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, ...@@ -379,7 +380,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def,
{ {
int ret = -1; int ret = -1;
virBitmapPtr map = NULL; virBitmapPtr map = NULL;
int i; size_t i;
int ndisks; int ndisks;
bool inuse; bool inuse;
...@@ -568,7 +569,7 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid, ...@@ -568,7 +569,7 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid,
int internal) int internal)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
int i; size_t i;
virCheckFlags(VIR_DOMAIN_XML_SECURE | virCheckFlags(VIR_DOMAIN_XML_SECURE |
VIR_DOMAIN_XML_UPDATE_CPU, NULL); VIR_DOMAIN_XML_UPDATE_CPU, NULL);
...@@ -767,7 +768,7 @@ virDomainSnapshotObjListGetNames(virDomainSnapshotObjListPtr snapshots, ...@@ -767,7 +768,7 @@ virDomainSnapshotObjListGetNames(virDomainSnapshotObjListPtr snapshots,
{ {
struct virDomainSnapshotNameData data = { names, maxnames, flags, 0, struct virDomainSnapshotNameData data = { names, maxnames, flags, 0,
false }; false };
int i; size_t i;
if (!from) { if (!from) {
/* LIST_ROOTS and LIST_DESCENDANTS have the same bit value, /* LIST_ROOTS and LIST_DESCENDANTS have the same bit value,
...@@ -1009,7 +1010,7 @@ virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots, ...@@ -1009,7 +1010,7 @@ virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotPtr *list = NULL; virDomainSnapshotPtr *list = NULL;
char **names; char **names;
int ret = -1; int ret = -1;
int i; size_t i;
if (!snaps || count < 0) if (!snaps || count < 0)
return count; return count;
...@@ -1043,7 +1044,7 @@ cleanup: ...@@ -1043,7 +1044,7 @@ cleanup:
bool bool
virDomainSnapshotDefIsExternal(virDomainSnapshotDefPtr def) virDomainSnapshotDefIsExternal(virDomainSnapshotDefPtr def)
{ {
int i; size_t i;
if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
return true; return true;
......
...@@ -264,7 +264,7 @@ static virStoragePoolTypeInfo poolTypeInfo[] = { ...@@ -264,7 +264,7 @@ static virStoragePoolTypeInfo poolTypeInfo[] = {
static virStoragePoolTypeInfoPtr static virStoragePoolTypeInfoPtr
virStoragePoolTypeInfoLookup(int type) virStoragePoolTypeInfoLookup(int type)
{ {
unsigned int i; size_t i;
for (i = 0; i < ARRAY_CARDINALITY(poolTypeInfo); i++) for (i = 0; i < ARRAY_CARDINALITY(poolTypeInfo); i++)
if (poolTypeInfo[i].poolType == type) if (poolTypeInfo[i].poolType == type)
return &poolTypeInfo[i]; return &poolTypeInfo[i];
...@@ -296,7 +296,7 @@ virStorageVolOptionsForPoolType(int type) ...@@ -296,7 +296,7 @@ virStorageVolOptionsForPoolType(int type)
void void
virStorageVolDefFree(virStorageVolDefPtr def) virStorageVolDefFree(virStorageVolDefPtr def)
{ {
int i; size_t i;
if (!def) if (!def)
return; return;
...@@ -338,7 +338,7 @@ virStoragePoolSourceAdapterClear(virStoragePoolSourceAdapter adapter) ...@@ -338,7 +338,7 @@ virStoragePoolSourceAdapterClear(virStoragePoolSourceAdapter adapter)
void void
virStoragePoolSourceClear(virStoragePoolSourcePtr source) virStoragePoolSourceClear(virStoragePoolSourcePtr source)
{ {
int i; size_t i;
if (!source) if (!source)
return; return;
...@@ -416,7 +416,7 @@ virStoragePoolObjFree(virStoragePoolObjPtr obj) ...@@ -416,7 +416,7 @@ virStoragePoolObjFree(virStoragePoolObjPtr obj)
void void
virStoragePoolObjListFree(virStoragePoolObjListPtr pools) virStoragePoolObjListFree(virStoragePoolObjListPtr pools)
{ {
unsigned int i; size_t i;
for (i = 0; i < pools->count; i++) for (i = 0; i < pools->count; i++)
virStoragePoolObjFree(pools->objs[i]); virStoragePoolObjFree(pools->objs[i]);
VIR_FREE(pools->objs); VIR_FREE(pools->objs);
...@@ -427,7 +427,7 @@ void ...@@ -427,7 +427,7 @@ void
virStoragePoolObjRemove(virStoragePoolObjListPtr pools, virStoragePoolObjRemove(virStoragePoolObjListPtr pools,
virStoragePoolObjPtr pool) virStoragePoolObjPtr pool)
{ {
unsigned int i; size_t i;
virStoragePoolObjUnlock(pool); virStoragePoolObjUnlock(pool);
...@@ -527,7 +527,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, ...@@ -527,7 +527,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
int ret = -1; int ret = -1;
xmlNodePtr relnode, *nodeset = NULL; xmlNodePtr relnode, *nodeset = NULL;
char *authType = NULL; char *authType = NULL;
int nsource, i; int nsource;
size_t i;
virStoragePoolOptionsPtr options; virStoragePoolOptionsPtr options;
char *name = NULL; char *name = NULL;
char *port = NULL; char *port = NULL;
...@@ -1039,7 +1040,7 @@ virStoragePoolSourceFormat(virBufferPtr buf, ...@@ -1039,7 +1040,7 @@ virStoragePoolSourceFormat(virBufferPtr buf,
virStoragePoolOptionsPtr options, virStoragePoolOptionsPtr options,
virStoragePoolSourcePtr src) virStoragePoolSourcePtr src)
{ {
int i, j; size_t i, j;
char uuid[VIR_UUID_STRING_BUFLEN]; char uuid[VIR_UUID_STRING_BUFLEN];
virBufferAddLit(buf," <source>\n"); virBufferAddLit(buf," <source>\n");
...@@ -1254,7 +1255,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool, ...@@ -1254,7 +1255,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
char *unit = NULL; char *unit = NULL;
xmlNodePtr node; xmlNodePtr node;
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
int i, n; size_t i;
int n;
options = virStorageVolOptionsForPoolType(pool->type); options = virStorageVolOptionsForPoolType(pool->type);
if (options == NULL) if (options == NULL)
...@@ -1524,7 +1526,7 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options, ...@@ -1524,7 +1526,7 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
virBufferEscapeString(buf, " <compat>%s</compat>\n", def->compat); virBufferEscapeString(buf, " <compat>%s</compat>\n", def->compat);
if (options->featureToString && def->features) { if (options->featureToString && def->features) {
int i; size_t i;
bool b; bool b;
bool empty = virBitmapIsAllClear(def->features); bool empty = virBitmapIsAllClear(def->features);
...@@ -1565,7 +1567,7 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool, ...@@ -1565,7 +1567,7 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
virBufferAddLit(&buf, " <source>\n"); virBufferAddLit(&buf, " <source>\n");
if (def->source.nextent) { if (def->source.nextent) {
int i; size_t i;
const char *thispath = NULL; const char *thispath = NULL;
for (i = 0; i < def->source.nextent; i++) { for (i = 0; i < def->source.nextent; i++) {
if (thispath == NULL || if (thispath == NULL ||
...@@ -1621,7 +1623,7 @@ virStoragePoolObjPtr ...@@ -1621,7 +1623,7 @@ virStoragePoolObjPtr
virStoragePoolObjFindByUUID(virStoragePoolObjListPtr pools, virStoragePoolObjFindByUUID(virStoragePoolObjListPtr pools,
const unsigned char *uuid) const unsigned char *uuid)
{ {
unsigned int i; size_t i;
for (i = 0; i < pools->count; i++) { for (i = 0; i < pools->count; i++) {
virStoragePoolObjLock(pools->objs[i]); virStoragePoolObjLock(pools->objs[i]);
...@@ -1637,7 +1639,7 @@ virStoragePoolObjPtr ...@@ -1637,7 +1639,7 @@ virStoragePoolObjPtr
virStoragePoolObjFindByName(virStoragePoolObjListPtr pools, virStoragePoolObjFindByName(virStoragePoolObjListPtr pools,
const char *name) const char *name)
{ {
unsigned int i; size_t i;
for (i = 0; i < pools->count; i++) { for (i = 0; i < pools->count; i++) {
virStoragePoolObjLock(pools->objs[i]); virStoragePoolObjLock(pools->objs[i]);
...@@ -1653,7 +1655,7 @@ virStoragePoolObjPtr ...@@ -1653,7 +1655,7 @@ virStoragePoolObjPtr
virStoragePoolSourceFindDuplicateDevices(virStoragePoolObjPtr pool, virStoragePoolSourceFindDuplicateDevices(virStoragePoolObjPtr pool,
virStoragePoolDefPtr def) virStoragePoolDefPtr def)
{ {
unsigned int i, j; size_t i, j;
for (i = 0; i < pool->def->source.ndevice; i++) { for (i = 0; i < pool->def->source.ndevice; i++) {
for (j = 0; j < def->source.ndevice; j++) { for (j = 0; j < def->source.ndevice; j++) {
...@@ -1668,7 +1670,7 @@ virStoragePoolSourceFindDuplicateDevices(virStoragePoolObjPtr pool, ...@@ -1668,7 +1670,7 @@ virStoragePoolSourceFindDuplicateDevices(virStoragePoolObjPtr pool,
void void
virStoragePoolObjClearVols(virStoragePoolObjPtr pool) virStoragePoolObjClearVols(virStoragePoolObjPtr pool)
{ {
unsigned int i; size_t i;
for (i = 0; i < pool->volumes.count; i++) for (i = 0; i < pool->volumes.count; i++)
virStorageVolDefFree(pool->volumes.objs[i]); virStorageVolDefFree(pool->volumes.objs[i]);
...@@ -1680,7 +1682,7 @@ virStorageVolDefPtr ...@@ -1680,7 +1682,7 @@ virStorageVolDefPtr
virStorageVolDefFindByKey(virStoragePoolObjPtr pool, virStorageVolDefFindByKey(virStoragePoolObjPtr pool,
const char *key) const char *key)
{ {
unsigned int i; size_t i;
for (i = 0; i < pool->volumes.count; i++) for (i = 0; i < pool->volumes.count; i++)
if (STREQ(pool->volumes.objs[i]->key, key)) if (STREQ(pool->volumes.objs[i]->key, key))
...@@ -1693,7 +1695,7 @@ virStorageVolDefPtr ...@@ -1693,7 +1695,7 @@ virStorageVolDefPtr
virStorageVolDefFindByPath(virStoragePoolObjPtr pool, virStorageVolDefFindByPath(virStoragePoolObjPtr pool,
const char *path) const char *path)
{ {
unsigned int i; size_t i;
for (i = 0; i < pool->volumes.count; i++) for (i = 0; i < pool->volumes.count; i++)
if (STREQ(pool->volumes.objs[i]->target.path, path)) if (STREQ(pool->volumes.objs[i]->target.path, path))
...@@ -1706,7 +1708,7 @@ virStorageVolDefPtr ...@@ -1706,7 +1708,7 @@ virStorageVolDefPtr
virStorageVolDefFindByName(virStoragePoolObjPtr pool, virStorageVolDefFindByName(virStoragePoolObjPtr pool,
const char *name) const char *name)
{ {
unsigned int i; size_t i;
for (i = 0; i < pool->volumes.count; i++) for (i = 0; i < pool->volumes.count; i++)
if (STREQ(pool->volumes.objs[i]->name, name)) if (STREQ(pool->volumes.objs[i]->name, name))
...@@ -1934,7 +1936,7 @@ virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def) ...@@ -1934,7 +1936,7 @@ virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
virStoragePoolOptionsPtr options; virStoragePoolOptionsPtr options;
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
const char *type; const char *type;
int i; size_t i;
options = virStoragePoolOptionsForPoolType(def->type); options = virStoragePoolOptionsForPoolType(def->type);
if (options == NULL) if (options == NULL)
...@@ -2034,7 +2036,7 @@ int ...@@ -2034,7 +2036,7 @@ int
virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools, virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools,
virStoragePoolDefPtr def) virStoragePoolDefPtr def)
{ {
int i; size_t i;
int ret = 1; int ret = 1;
virStoragePoolObjPtr pool = NULL; virStoragePoolObjPtr pool = NULL;
virStoragePoolObjPtr matchpool = NULL; virStoragePoolObjPtr matchpool = NULL;
...@@ -2197,7 +2199,7 @@ virStoragePoolObjListExport(virConnectPtr conn, ...@@ -2197,7 +2199,7 @@ virStoragePoolObjListExport(virConnectPtr conn,
virStoragePoolPtr pool = NULL; virStoragePoolPtr pool = NULL;
int npools = 0; int npools = 0;
int ret = -1; int ret = -1;
int i; size_t i;
if (pools && VIR_ALLOC_N(tmp_pools, poolobjs.count + 1) < 0) if (pools && VIR_ALLOC_N(tmp_pools, poolobjs.count + 1) < 0)
goto cleanup; goto cleanup;
......
...@@ -130,7 +130,8 @@ virStorageEncryptionParseXML(xmlXPathContextPtr ctxt) ...@@ -130,7 +130,8 @@ virStorageEncryptionParseXML(xmlXPathContextPtr ctxt)
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
virStorageEncryptionPtr ret; virStorageEncryptionPtr ret;
char *format_str; char *format_str;
int format, i, n; int format, n;
size_t i;
if (VIR_ALLOC(ret) < 0) if (VIR_ALLOC(ret) < 0)
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册