Thread (7 messages) 7 messages, 2 authors, 2025-03-16

Re: [PATCH v2] man/man3/wc{,r}tomb.3: Rewording to MB_CUR_MAX

From: Alejandro Colomar <alx@kernel.org>
Date: 2025-03-16 19:49:43

Hi!

On Mon, Mar 17, 2025 at 02:32:13AM +0800, Kang-Che Sung wrote:
Add the missing length requirement about MB_CUR_MAX to wcrtomb(3).

Change the wording on the MB_CUR_MAX requirement in wctomb(3). If
programmers know the wide character to convert beforehand, they are
allowed to use a buffer smaller than MB_CUR_MAX bytes, as long as it
"fits" the sequence.

Signed-off-by: Kang-Che Sung <redacted>
Thanks!  I've applied the patch.
<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=03f0a95096ac8a95124bad3b65fc4d92bfb2d0c1>


Have a lovely day!
Alex
quoted hunk ↗ jump to hunk
---
 man/man3/wcrtomb.3 | 8 ++++++++
 man/man3/wctomb.3  | 8 +++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/man/man3/wcrtomb.3 b/man/man3/wcrtomb.3
index 967a1a0f6..162d97df8 100644
--- a/man/man3/wcrtomb.3
+++ b/man/man3/wcrtomb.3
@@ -94,6 +94,14 @@ is NULL, a static anonymous
 state known only to the
 .BR wcrtomb ()
 function is used instead.
+.P
+At most
+.B MB_CUR_MAX
+bytes will be written at
+.IR s .
+The programmer must ensure that there is enough room to store the
+multibyte sequence at
+.IR s .
 .SH RETURN VALUE
 The
 .BR wcrtomb ()
diff --git a/man/man3/wctomb.3 b/man/man3/wctomb.3
index fce54cb4b..643e2e677 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 will be written at
+.IR s .
+The programmer must ensure that there is enough room to store the
+multibyte sequence at
 .IR s .
 .P
 If
-- 
2.49.0
-- 
<https://www.alejandro-colomar.es/>

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help