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

Re: [libvirt] [PATCH 04/32] Convert 'int i' to 'size_t i' in tests/ files



On 07/08/2013 04:21 PM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange 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 redhat com>
> ---
>  tests/commandhelper.c       |  4 ++--
>  tests/cputest.c             |  6 +++---
>  tests/esxutilstest.c        |  9 +++++----
>  tests/eventtest.c           | 14 +++++++-------
>  tests/nodeinfotest.c        |  2 +-
>  tests/openvzutilstest.c     |  2 +-
>  tests/qemuhelptest.c        |  6 +++---
>  tests/qemumonitorjsontest.c |  6 +++---
>  tests/qemumonitortest.c     |  4 ++--
>  tests/ssh.c                 |  2 +-
>  tests/testutils.c           | 13 +++++++------
>  tests/utiltest.c            | 16 +++++++++-------
>  tests/viratomictest.c       |  4 ++--
>  tests/virbitmaptest.c       |  9 +++++----
>  tests/vircgrouptest.c       |  2 +-
>  tests/virhashtest.c         | 12 ++++++------
>  tests/virnetsockettest.c    |  2 +-
>  tests/virstoragetest.c      |  2 +-
>  18 files changed, 60 insertions(+), 55 deletions(-)
> 

> @@ -180,7 +180,7 @@ static int test4(const void *data ATTRIBUTE_UNUSED)
>          28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39
>      };
>      virBitmapPtr bitmap = NULL;
> -    int i, j;
> +    size_t i, j;

I think ssize_t would be better for i, since we call:

virBitmapNextClearBit(bitmap, i - 1)

>  
>      if (ARRAY_CARDINALITY(bitsPos) + ARRAY_CARDINALITY(bitsPosInv) != size)
>          goto error;

ACK

Jan


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