On 7/22/25 19:59, Aaron M. Brown wrote:
> This patch corrects the header comment for virBitmapNextClearBIt.
> Currently, the header comment reads:
> 
> `@pos can be -1 to search for the first set bit.`
> 
> However, this statement is false.
> 
> We can prove this by referencing the virbitmaptest functions, i.e
> virbitmaptest.c:223, in which i = 0
> 
> if (virBitmapNextClearBIt(bitmap, -1) != 0)
>     return -1
> 
> Because this is a zero set, this case would fail if the header statement was 
> true as is.

Long story short, the function searches a clear bit. I suspect a copy
paste error.

> 
> Signed-off-by: Aaron M. Brown <aaron...@linux.ibm.com>
> ---
>  src/util/virbitmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
> index 8a3f33c806..1a3e75671c 100644
> --- a/src/util/virbitmap.c
> +++ b/src/util/virbitmap.c
> @@ -948,7 +948,7 @@ virBitmapLastSetBit(virBitmap *bitmap)
>   * @pos: the position after which to search for a clear bit
>   *
>   * Search for the first clear bit after position @pos in bitmap @bitmap.
> - * @pos can be -1 to search for the first set bit. Position starts
> + * @pos can be -1 to search for the first clear bit. Position starts
>   * at 0.
>   *
>   * Returns the position of the found bit, or -1 if no bit found.

Reviewed-by: Michal Privoznik <mpriv...@redhat.com>

and merged. Congratulations on your first libvirt contribution!

Michal

Reply via email to