[PATCH v6 2/7] libbb: INT_BUF_MAX(): new macro
Mike Frysinger
vapier at gentoo.org
Thu Mar 17 17:18:44 UTC 2016
On 17 Mar 2016 15:52, Bartosz Golaszewski wrote:
> Add a simple macro calculating the size needed to store the string
> representation of an integer type (both signed and unsigned) together
> with the terminating NUL-character.
>
> Suggested-by: Michael Conrad <mconrad at intellitree.com>
> Signed-off-by: Bartosz Golaszewski <bartekgola at gmail.com>
> ---
> include/libbb.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/libbb.h b/include/libbb.h
> index 64e8490..0713917 100644
> --- a/include/libbb.h
> +++ b/include/libbb.h
> @@ -297,6 +297,7 @@ struct BUG_off_t_size_is_misdetected {
> #define SKIP ((int) 2)
>
> #define BIT(nr) (1UL << (nr))
> +#define INT_BUF_MAX(type) (sizeof(type) * 24 / 10 + 3)
should add a comment explaining the API & design behind it.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20160317/1964d0ab/attachment.asc>
More information about the busybox
mailing list