Re: [PATCH v2 15/15] test: Refactor testNodeGetCPUMap

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

 



On Wed, Jun 24, 2015 at 04:11:57PM +0200, Peter Krempa wrote:
> Drop locking of the driver since it is not accessed and simplify the
> code flow.
> ---
>  src/test/test_driver.c | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index ed67dca..25de641 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -5611,31 +5611,23 @@ static int testConnectListAllDomains(virConnectPtr conn,
>  }
> 
>  static int
> -testNodeGetCPUMap(virConnectPtr conn,
> +testNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED,
>                    unsigned char **cpumap,
>                    unsigned int *online,
>                    unsigned int flags)
>  {
> -    testDriverPtr privconn = conn->privateData;
> -    int ret = -1;
> -
>      virCheckFlags(0, -1);
> 
> -    testDriverLock(privconn);
>      if (cpumap) {
>          if (VIR_ALLOC_N(*cpumap, 1) < 0)
> -            goto cleanup;
> +            return -1;
>          *cpumap[0] = 0x15;
>      }
> 
>      if (online)
>          *online = 3;
> 
> -    ret = 8;
> -
> - cleanup:
> -    testDriverUnlock(privconn);
> -    return ret;
> +    return  8;

It would be nice to have a #define for that value instead of a magic number,
but if you decide to leave it here, remove the extra space.

Pavel

>  }
> 
>  static char *
> -- 
> 2.4.1
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

--
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]