diff options
author | Ammar Faizi | 2022-03-29 17:17:36 +0700 |
---|---|---|
committer | Paul E. McKenney | 2022-04-20 17:05:46 -0700 |
commit | b26823c19a12d9a06207ad3051e3d1059a9e1005 (patch) | |
tree | 2556910069b586e8f75c67efbbdf675191b69031 /.mailmap | |
parent | 0e0ff638400be8f497a35b51a4751fd823f6bd6a (diff) |
tools/nolibc/string: Implement `strnlen()`
size_t strnlen(const char *str, size_t maxlen);
The strnlen() function returns the number of bytes in the string
pointed to by sstr, excluding the terminating null byte ('\0'), but at
most maxlen. In doing this, strnlen() looks only at the first maxlen
characters in the string pointed to by str and never beyond str[maxlen-1].
The first use case of this function is for determining the memory
allocation size in the strndup() function.
Link: https://lore.kernel.org/lkml/CAOG64qMpEMh+EkOfjNdAoueC+uQyT2Uv3689_sOr37-JxdJf4g@mail.gmail.com
Suggested-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
Acked-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to '.mailmap')
0 files changed, 0 insertions, 0 deletions