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

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

From: Kang-Che Sung <hidden>
Date: 2025-03-16 09:08:00
Subsystem: the rest · Maintainer: Linus Torvalds

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.

Signed-off-by: Kang-Che Sung <redacted>
---
 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
+.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.
 If
 .I wc
 can not be
-- 
2.49.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help