[glibc] manual: Update memchr description [BZ #19406]
Wilco Dijkstra via Glibc-cvs <[email protected]> Wed, 17 Jun 2026 11:51:32 +0000 (GMT)
| Newsgroups | gmane.comp.lib.glibc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=368438d8b6e28b034dbf4722290ae4b3989bac57 commit 368438d8b6e28b034dbf4722290ae4b3989bac57 Author: Wilco Dijkstra <[email protected]> Date: Mon Jun 15 16:11:55 2026 +0000 manual: Update memchr description [BZ #19406] Update memchr description to indicate it cannot overread and the size may be larger than the object passed. This is required since C11. Suggested-by: Paul Eggert <[email protected]> Reviewed-by: Paul Eggert <[email protected]> Diff: --- manual/string.texi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manual/string.texi b/manual/string.texi index 24004f1f5c..b7a9ba0d46 100644 --- a/manual/string.texi +++ b/manual/string.texi @@ -1803,6 +1803,12 @@ to an @code{unsigned char}) in the initial @var{size} bytes of the object beginning at @var{block}. The return value is a pointer to the located byte, or a null pointer if no match was found. +This function behaves as if it reads the bytes sequentially and stops at +the first match, which means that if the object contains a match the +behavior is defined even when the object size is less than @var{size}. +This behavior guarantee is unusual, and is not shared by related +functions like @code{memcmp} and @code{wmemchr}. + In ISO C23 and later, this function is qualifier-generic: that is, it is also implemented as a function-like macro, and when the macro is used and @var{block} has a type