[libvirt] [PATCH 03/32] Convert 'int i' to 'size_t i' in src/util/ files
Guannan Ren
gren at redhat.com
Tue Jul 9 11:19:09 UTC 2013
On 07/08/2013 10:21 PM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at 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 at redhat.com>
> ---
> src/util/virbitmap.c | 13 +++++++------
> src/util/vircgroup.c | 32 ++++++++++++++++----------------
> src/util/vircommand.c | 10 +++++-----
> src/util/virdnsmasq.c | 16 ++++++++--------
> src/util/virebtables.c | 8 ++++----
> src/util/vireventpoll.c | 28 ++++++++++++++--------------
> src/util/virhook.c | 3 ++-
> src/util/virjson.c | 12 ++++++------
> src/util/virkeycode.c | 4 ++--
> src/util/virlog.c | 30 +++++++++++++++---------------
> src/util/virlog.h | 2 +-
> src/util/virmacaddr.c | 2 +-
> src/util/virnetdevmacvlan.c | 2 +-
> src/util/virnetdevopenvswitch.c | 2 +-
> src/util/virnetdevtap.c | 4 ++--
> src/util/virnetdevvportprofile.c | 2 +-
> src/util/virnetlink.c | 14 ++++++++------
> src/util/virnuma.c | 13 +++++++------
> src/util/virpci.c | 14 +++++++-------
> src/util/virportallocator.c | 8 ++++----
> src/util/virprocess.c | 7 ++++---
> src/util/virscsi.c | 6 +++---
> src/util/virsocketaddr.c | 28 ++++++++++++++--------------
> src/util/virstoragefile.c | 7 ++++---
> src/util/virstring.c | 3 ++-
> src/util/virsysinfo.c | 6 +++---
> src/util/virthreadwin32.c | 6 +++---
> src/util/virthreadwin32.h | 2 +-
> src/util/virtypedparam.c | 10 +++++-----
> src/util/viruri.c | 2 +-
> src/util/virusb.c | 6 +++---
> src/util/virutil.c | 29 ++++++++++++++++-------------
> src/util/viruuid.c | 7 ++++---
> 33 files changed, 175 insertions(+), 163 deletions(-)
...
> diff --git a/src/util/virpci.c b/src/util/virpci.c
> index 54f7715..a3353cc 100644
> --- a/src/util/virpci.c
> +++ b/src/util/virpci.c
> @@ -1672,7 +1672,7 @@ static void
> virPCIDeviceListDispose(void *obj)
> {
> virPCIDeviceListPtr list = obj;
> - int i;
> + size_t i;
>
> for (i = 0; i < list->count; i++) {
> virPCIDeviceFree(list->devs[i]);
> @@ -1780,7 +1780,7 @@ virPCIDeviceListDel(virPCIDeviceListPtr list,
> int
> virPCIDeviceListFindIndex(virPCIDeviceListPtr list, virPCIDevicePtr dev)
> {
> - int i;
> + size_t i;
>
> for (i = 0; i < list->count; i++)
> if (list->devs[i]->domain == dev->domain &&
> @@ -1799,7 +1799,7 @@ virPCIDeviceListFindByIDs(virPCIDeviceListPtr list,
> unsigned int slot,
> unsigned int function)
> {
> - int i;
> + size_t i;
>
> for (i = 0; i < list->count; i++) {
> if (list->devs[i]->domain == domain &&
> @@ -1815,10 +1815,10 @@ virPCIDeviceListFindByIDs(virPCIDeviceListPtr list,
> virPCIDevicePtr
> virPCIDeviceListFind(virPCIDeviceListPtr list, virPCIDevicePtr dev)
> {
> - int i;
> + int idx;
>
> - if ((i = virPCIDeviceListFindIndex(list, dev)) >= 0)
> - return list->devs[i];
> + if ((idx = virPCIDeviceListFindIndex(list, dev)) >= 0)
> + return list->devs[idx];
> else
> return NULL;
> }
> @@ -2416,7 +2416,7 @@ virPCIGetVirtualFunctions(const char *sysfs_path,
> unsigned int *num_virtual_functions)
> {
> int ret = -1;
> - int i;
> + size_t i;
> DIR *dir = NULL;
> struct dirent *entry = NULL;
> char *device_link = NULL;
> diff --git a/src/util/virportallocator.c b/src/util/virportallocator.c
> index 0757966..6730d00 100644
> --- a/src/util/virportallocator.c
> +++ b/src/util/virportallocator.c
> @@ -98,7 +98,7 @@ int virPortAllocatorAcquire(virPortAllocatorPtr pa,
> unsigned short *port)
> {
> int ret = -1;
> - int i;
> + size_t i;
> int fd = -1;
>
> *port = 0;
> @@ -112,7 +112,7 @@ int virPortAllocatorAcquire(virPortAllocatorPtr pa,
> if (virBitmapGetBit(pa->bitmap,
> i - pa->start, &used) < 0) {
> virReportError(VIR_ERR_INTERNAL_ERROR,
> - _("Failed to query port %d"), i);
> + _("Failed to query port %zu"), i);
> goto cleanup;
> }
>
> @@ -138,7 +138,7 @@ int virPortAllocatorAcquire(virPortAllocatorPtr pa,
> if (bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
> if (errno != EADDRINUSE) {
> virReportSystemError(errno,
> - _("Unable to bind to port %d"), i);
> + _("Unable to bind to port %zu"), i);
> goto cleanup;
> }
> /* In use, try next */
> @@ -148,7 +148,7 @@ int virPortAllocatorAcquire(virPortAllocatorPtr pa,
> if (virBitmapSetBit(pa->bitmap,
> i - pa->start) < 0) {
> virReportError(VIR_ERR_INTERNAL_ERROR,
> - _("Failed to reserve port %d"), i);
> + _("Failed to reserve port %zu"), i);
> goto cleanup;
> }
> *port = i;
virPCIGetVirtualFunctionIndex() is missing
Guannan
More information about the libvir-list
mailing list