The virBitmapIsBitSet API is a permissive one which returns false when
the bit is not set or is out of range. We can do the same if the bitmap
is NULL to aid certain situations when this can happen, but we don't
want to add extra checks.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
/**
* virBitmapIsBitSet:
- * @bitmap: Pointer to bitmap
+ * @bitmap: Pointer to bitmap (May be NULL)
* @b: bit position to get
*
* Get setting of bit position @b in @bitmap.
virBitmapIsBitSet(virBitmap *bitmap,
size_t b)
{
- if (bitmap->nbits <= b)
+ if (!bitmap || bitmap->nbits <= b)
return false;
return virBitmapIsSet(bitmap, b);
* Get bit @b in @bitmap. Returns false if b is out of range.
*/
bool virBitmapIsBitSet(virBitmap *bitmap, size_t b)
- ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
+ G_GNUC_WARN_UNUSED_RESULT;
/*
* Get setting of bit position @b in @bitmap and store in @result
*/