Re: [PATCH 05/32] Convert 'int i' to 'size_t i' in tools/ files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/08/2013 04:21 PM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---
>  tools/virsh-domain-monitor.c | 17 +++++++++--------
>  tools/virsh-domain.c         | 41 +++++++++++++++++++++++------------------
>  tools/virsh-host.c           |  8 ++++----
>  tools/virsh-interface.c      |  6 +++---
>  tools/virsh-network.c        |  6 +++---
>  tools/virsh-nodedev.c        |  8 ++++----
>  tools/virsh-nwfilter.c       |  6 +++---
>  tools/virsh-pool.c           |  7 ++++---
>  tools/virsh-secret.c         |  6 +++---
>  tools/virsh-snapshot.c       | 12 ++++++------
>  tools/virsh-volume.c         |  6 +++---
>  tools/virsh.c                | 15 ++++++++-------
>  12 files changed, 73 insertions(+), 65 deletions(-)
> 

> diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
> index fb10119..ac11e53 100644
> --- a/tools/virsh-secret.c
> +++ b/tools/virsh-secret.c
> @@ -367,7 +367,7 @@ typedef struct vshSecretList *vshSecretListPtr;
>  static void
>  vshSecretListFree(vshSecretListPtr list)
>  {
> -    int i;
> +    size_t i;
>  
>      if (list && list->nsecrets) {
>          for (i = 0; i < list->nsecrets; i++) {
> @@ -384,7 +384,7 @@ vshSecretListCollect(vshControl *ctl,
>                       unsigned int flags)
>  {
>      vshSecretListPtr list = vshMalloc(ctl, sizeof(*list));
> -    int i;
> +    size_t i;
>      int ret;
>      virSecretPtr secret;
>      bool success = false;

If we use the fallback method and virConnectNumOfSecrets returns -1,
the cleanup loop might take too long:
     for (i = 0; i < nsecrets; i++)

> @@ -1095,7 +1095,7 @@ vshSnapshotListCollect(vshControl *ctl, virDomainPtr dom,
>                         virDomainSnapshotPtr from,
>                         unsigned int orig_flags, bool tree)
>  {
> -    int i;
> +    size_t i;
>      char **names = NULL;
>      int count = -1;
>      bool descendants = false;

Same in this function.

> @@ -1203,7 +1203,7 @@ vshStorageVolListCollect(vshControl *ctl,
>                           unsigned int flags)
>  {
>      vshStorageVolListPtr list = vshMalloc(ctl, sizeof(*list));
> -    int i;
> +    size_t i;
>      char **names = NULL;
>      virStorageVolPtr vol = NULL;
>      bool success = false;

This one too.

ACK

Jan

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]