[PATCH 1/2] man/man3/wctomb.3: Rewording to MB_CUR_MAX requirement

Alejandro Colomar alx@kernel.org
Sun Mar 16 12:08:57 GMT 2025


Hi Kang-Che Sung,

On Sun, Mar 16, 2025 at 05:07:48PM +0800, Kang-Che Sung wrote:
> The "must" wording on the MB_CUR_MAX length requirement could be too
> strict for what the standard allows to the "s" buffer length. If the
> programmer knows the wide character to convert beforehand, they can
> allocate the buffer whose size "just fits" for the sequence.

Ok.

> 
> Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
> ---
>  man/man3/wctomb.3 | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/man/man3/wctomb.3 b/man/man3/wctomb.3
> index fce54cb4b..f6aefcd0d 100644
> --- a/man/man3/wctomb.3
> +++ b/man/man3/wctomb.3
> @@ -42,10 +42,12 @@ that is, the number of
>  bytes written at
>  .IR s .
>  .P
> -The programmer must ensure that there is
> -room for at least
> +At most
>  .B MB_CUR_MAX
> -bytes at
> +bytes can be written at

I think s/can/will/

> +.IR s .
> +The programmer must ensure that there is enough room to store the
> +multibyte sequence at
>  .IR s .
>  .P
>  If
> @@ -68,6 +70,9 @@ function
>  returns the number of bytes
>  that have been written to the byte array at
>  .IR s .
> +The value returned will never be greater than the value of the
> +.B MB_CUR_MAX
> +macro.

This part is redundant.  Let's not add it.


Have a lovely day!
Alex

>  If
>  .I wc
>  can not be
> -- 
> 2.49.0

-- 
<https://www.alejandro-colomar.es/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20250316/34ace5c5/attachment.sig>


More information about the Libc-alpha mailing list