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

[PATCH 2/2] man/man3/wcrtomb.3: Document MB_CUR_MAX length requirement

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

The wcrtomb(3) function, like wctomb(3), has a length requirement about
MB_CUR_MAX. So copy the wording about MB_CUR_MAX from wctomb(3) to
wcrtomb(3).

Signed-off-by: Kang-Che Sung <redacted>
---
 man/man3/wcrtomb.3 | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff --git a/man/man3/wcrtomb.3 b/man/man3/wcrtomb.3
index 967a1a0f6..27b5bd9c1 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 can 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 ()
@@ -101,6 +109,9 @@ function returns the number of
 bytes that have been or would
 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