[libvirt] [PATCH 26/32] Convert 'int i' to 'size_t i' in src/interface/ files

Ján Tomko jtomko at redhat.com
Tue Jul 9 13:36:02 UTC 2013


On 07/08/2013 04: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/interface/interface_backend_netcf.c | 6 +++---
>  src/interface/interface_backend_udev.c  | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
> index 760540a..3b1d0bd 100644
> --- a/src/interface/interface_backend_netcf.c
> +++ b/src/interface/interface_backend_netcf.c
> @@ -217,7 +217,7 @@ static int netcfConnectNumOfInterfacesImpl(virConnectPtr conn,
>      int count;
>      int want = 0;
>      int ret = -1;
> -    int i;
> +    size_t i;
>      char **names = NULL;
>  
>      /* List all interfaces, in case we might support new filter flags

In the cleanup section there is
         for (i = 0; i < count; i++)
but count can be negative here.

> @@ -313,7 +313,7 @@ static int netcfConnectListInterfacesImpl(virConnectPtr conn,
>      int count = 0;
>      int want = 0;
>      int ret = -1;
> -    int i;
> +    size_t i;
>      char **allnames = NULL;
>  
>      count = ncf_num_of_interfaces(driver->netcf, status);
> @@ -483,7 +483,7 @@ netcfConnectListAllInterfaces(virConnectPtr conn,
>  {
>      struct interface_driver *driver = conn->interfacePrivateData;
>      int count;
> -    int i;
> +    size_t i;
>      struct netcf_if *iface = NULL;
>      virInterfacePtr *tmp_iface_objs = NULL;
>      virInterfacePtr iface_obj = NULL;

Same for these two functions.

> diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
> index 6270c9d..0e99ccb 100644
> --- a/src/interface/interface_backend_udev.c
> +++ b/src/interface/interface_backend_udev.c
> @@ -641,7 +641,7 @@ udevGetIfaceDefBond(struct udev *udev,
>  {
>      struct dirent **slave_list = NULL;
>      int slave_count = 0;
> -    int i;
> +    size_t i;
>      const char *tmp_str;
>      int tmp_int;

Same for slave_count here.

>  
> @@ -872,7 +872,7 @@ udevGetIfaceDefBridge(struct udev *udev,
>      char *member_path;
>      const char *tmp_str;
>      int stp;
> -    int i;
> +    size_t i;
>  
>      /* Set our type to Bridge  */
>      ifacedef->type = VIR_INTERFACE_TYPE_BRIDGE;
> 

And member_count here.

Jan




More information about the libvir-list mailing list