[PATCH 03/15] virBitmapToString|virBitmapNewString: Clarify semantics of the 'string'

Ján Tomko jtomko at redhat.com
Fri Oct 2 11:17:17 UTC 2020


On a Friday in 2020, Peter Krempa wrote:
>Clarify which bit is considered most significant in the bitmap and
>resulting string. Also be explicit that it's a hex string.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/util/virbitmap.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
>diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
>index ad5213f216..fcb8e1101a 100644
>--- a/src/util/virbitmap.c
>+++ b/src/util/virbitmap.c
>@@ -328,7 +328,9 @@ virBitmapGetBit(virBitmapPtr bitmap,
>  * virBitmapToString:
>  * @bitmap: Pointer to bitmap
>  *
>- * Convert @bitmap to printable string.
>+ * Convert @bitmap to printable hexadecimal string representation. Note that bit
>+ * with highest position/index in @bitmap are considered as most significant bit
>+ * in the output string.

the bits ... are considered
  or
the bit ... is considered

would mentioning that it is printed at the leftmost position be clearer?

>  *
>  * Returns pointer to the string or NULL on error.
>  */
>@@ -1117,10 +1119,13 @@ virBitmapCountBits(virBitmapPtr bitmap)
>  * virBitmapNewString:
>  * @string: the string to be converted to a bitmap
>  *
>- * Allocate a bitmap from a string of hexadecimal data.
>+ * Allocate a bitmap and populate it from a string of hexadecimal data. Note
>+ * that leftmost character in the string will correspond to the highest
>+ * index/position in the bitmap. The size of the returned bitmap corresponds to
>+ * 4 * the length of @string.
>  *
>- * Returns a pointer to the allocated bitmap or NULL if
>- * memory cannot be allocated.
>+ * Returns a pointer to the allocated bitmap or NULL and reports an error if
>+ * @string can't be converted.
>  */
> virBitmapPtr
> virBitmapNewString(const char *string)

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201002/30b3ad9b/attachment-0001.sig>


More information about the libvir-list mailing list