mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virBitmapIsBitSet: Allow NULL bitmap
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>
This commit is contained in:
parent
9598c3c684
commit
f836947a91
@ -216,7 +216,7 @@ virBitmapIsSet(virBitmap *bitmap, size_t b)
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@ -228,7 +228,7 @@ bool
|
||||
virBitmapIsBitSet(virBitmap *bitmap,
|
||||
size_t b)
|
||||
{
|
||||
if (bitmap->nbits <= b)
|
||||
if (!bitmap || bitmap->nbits <= b)
|
||||
return false;
|
||||
|
||||
return virBitmapIsSet(bitmap, b);
|
||||
|
@ -61,7 +61,7 @@ void virBitmapClearBitExpand(virBitmap *bitmap, size_t 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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user