[libvirt] [PATCH v3] util: Add a helper to check if all bits of a bitmap are clear

Eric Blake eblake at redhat.com
Fri Apr 5 17:30:53 UTC 2013


On 04/05/2013 12:06 PM, Osier Yang wrote:
> ---
>  src/libvirt_private.syms |  1 +
>  src/util/virbitmap.c     | 17 +++++++++++++++++
>  src/util/virbitmap.h     |  3 +++
>  tests/virbitmaptest.c    | 33 ++++++++++++++++++++++++++++++++-
>  4 files changed, 53 insertions(+), 1 deletion(-)

ACK with one suggestion:

> +static int test8(const void *v ATTRIBUTE_UNUSED)
> +{
> +    virBitmapPtr bitmap = NULL;
> +    char data[108] = {0x00,};
> +
> +    bitmap = virBitmapNewData(data, sizeof(data));
> +    if (!bitmap)
> +        goto error;
> +
> +    if (!virBitmapIsAllClear(bitmap))
> +        goto error;

Here, it would also be handy to set a bit, then check that
virBitmapIsAllClear returns false (all the tests that you added merely
check that virBitmapIsAllClear returns true when it should).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130405/a25eabfa/attachment-0001.sig>


More information about the libvir-list mailing list