diff --git a/lib/libc/string/bstring.3 b/lib/libc/string/bstring.3 --- a/lib/libc/string/bstring.3 +++ b/lib/libc/string/bstring.3 @@ -29,7 +29,7 @@ .\" .\" @(#)bstring.3 8.1 (Berkeley) 6/4/93 .\" -.Dd June 4, 1993 +.Dd December 5, 2023 .Dt BSTRING 3 .Os .Sh NAME @@ -58,7 +58,7 @@ .Ft int .Fn memcmp "const void *b1" "const void *b2" "size_t len" .Ft void * -.Fn memccpy "void *dst" "const void *src" "int c" "size_t len" +.Fn memccpy "void * restrict dst" "const void * restrict src" "int c" "size_t len" .Ft void * .Fn memcpy "void *dst" "const void *src" "size_t len" .Ft void * @@ -80,6 +80,7 @@ .Xr memccpy 3 , .Xr memchr 3 , .Xr memcmp 3 , +.Xr memccpy 3 , .Xr memcpy 3 , .Xr memmove 3 , .Xr memset 3 diff --git a/lib/libc/string/memccpy.3 b/lib/libc/string/memccpy.3 --- a/lib/libc/string/memccpy.3 +++ b/lib/libc/string/memccpy.3 @@ -27,7 +27,7 @@ .\" .\" @(#)memccpy.3 8.1 (Berkeley) 6/9/93 .\" -.Dd June 9, 1993 +.Dd December 5, 2023 .Dt MEMCCPY 3 .Os .Sh NAME @@ -38,7 +38,7 @@ .Sh SYNOPSIS .In string.h .Ft void * -.Fn memccpy "void *dst" "const void *src" "int c" "size_t len" +.Fn memccpy "void * restrict dst" "const void * restrict src" "int c" "size_t len" .Sh DESCRIPTION The .Fn memccpy @@ -61,13 +61,30 @@ Otherwise, .Fa len bytes are copied, and a NULL pointer is returned. +If +.Fa src +and +.Fa dst +overlap, behavior is undefined. .Sh SEE ALSO .Xr bcopy 3 , .Xr memcpy 3 , .Xr memmove 3 , .Xr strcpy 3 +.Sh STANDARDS +The +.Fn memccpy +function conforms to +.St -p1003.1-2004 +and +.\" St -isoC-2024 . +ISO/IEC 9899:2024 (\(lqISO\~C23\(rq). .Sh HISTORY The .Fn memccpy function first appeared in .Bx 4.4 . +The +.Ft restrict +keyword was added to the prototype in +.Fx 14.1 . diff --git a/lib/libc/string/memccpy.c b/lib/libc/string/memccpy.c --- a/lib/libc/string/memccpy.c +++ b/lib/libc/string/memccpy.c @@ -36,7 +36,7 @@ #include void * -memccpy(void *t, const void *f, int c, size_t n) +memccpy(void * __restrict t, const void * __restrict f, int c, size_t n) { if (n) {