Re: git: 441995e161a2 - main - memchr.3: mention the len argument in the functions description
- Reply: Ed Maste : "Re: git: 441995e161a2 - main - memchr.3: mention the len argument in the functions description"
- In reply to: Konstantin Belousov : "git: 441995e161a2 - main - memchr.3: mention the len argument in the functions description"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Jul 2025 09:05:09 UTC
On 22/07/2025 18:11, Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=441995e161a2564d37947d054a2f1219754deb5f > > commit 441995e161a2564d37947d054a2f1219754deb5f > Author: Konstantin Belousov <kib@FreeBSD.org> > AuthorDate: 2025-07-19 12:15:44 +0000 > Commit: Konstantin Belousov <kib@FreeBSD.org> > CommitDate: 2025-07-22 15:11:40 +0000 > > memchr.3: mention the len argument in the functions description > > Otherwise, its use is only specified in the error case, which is > somewhat obscure. Also properly typeset NULL. > > Reviewed by: pauamma_gundo.com > Discussed with: emaste > Sponsored by: The FreeBSD Foundation > MFC after: 3 days > Differential revision: https://reviews.freebsd.org/D51424 > --- > lib/libc/string/memchr.3 | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > > diff --git a/lib/libc/string/memchr.3 b/lib/libc/string/memchr.3 > index f5d1fe5d5c7f..65617a117371 100644 > --- a/lib/libc/string/memchr.3 > +++ b/lib/libc/string/memchr.3 > @@ -52,7 +52,10 @@ locates the first occurrence of > (converted to an > .Vt "unsigned char" ) > in string Maybe this is also a good time to change 'string' to 'memory object' (using POSIX wording) or something of that kind. Most people would read 'string' as C string which the parameter doesn't have to be. > -.Fa b . > +.Fa b , > +limited to at most > +.Fa len > +characters. > .Pp > The > .Fn memrchr > @@ -61,15 +64,18 @@ function behaves like > except that it locates the last occurrence of > .Fa c > in string > -.Fa b . > +.Fa b , > +limited to the first > +.Fa len > +characters. > .Sh RETURN VALUES > The > .Fn memchr > and > .Fn memrchr > -functions > -return a pointer to the byte located, > -or NULL if no such byte exists within > +functions return a pointer to the byte located, or > +.Dv NULL > +if no such byte exists within > .Fa len > bytes. > .Sh SEE ALSO -- Andriy Gapon