Add restrict qualifiers to the parameters to strlcpy() and strlcat().
The annotation mainly just serves as a hint that they're not intended for use with overlapping strings.
This commit is contained in:
parent
dce7ffd6df
commit
e00a6d21eb
@ -85,8 +85,8 @@ char *strerror(int);
|
||||
int strerror_r(int, char *, size_t);
|
||||
#endif
|
||||
#if __BSD_VISIBLE
|
||||
size_t strlcat(char *, const char *, size_t);
|
||||
size_t strlcpy(char *, const char *, size_t);
|
||||
size_t strlcat(char * __restrict, const char * __restrict, size_t);
|
||||
size_t strlcpy(char * __restrict, const char * __restrict, size_t);
|
||||
#endif
|
||||
size_t strlen(const char *) __pure;
|
||||
#if __BSD_VISIBLE
|
||||
|
@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$");
|
||||
* If retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t
|
||||
strlcat(char *dst, const char *src, size_t siz)
|
||||
strlcat(char * __restrict dst, const char * __restrict src, size_t siz)
|
||||
{
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
|
@ -39,9 +39,9 @@
|
||||
.Sh SYNOPSIS
|
||||
.In string.h
|
||||
.Ft size_t
|
||||
.Fn strlcpy "char *dst" "const char *src" "size_t size"
|
||||
.Fn strlcpy "char * restrict dst" "const char * restrict src" "size_t size"
|
||||
.Ft size_t
|
||||
.Fn strlcat "char *dst" "const char *src" "size_t size"
|
||||
.Fn strlcat "char * restrict dst" "const char * restrict src" "size_t size"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn strlcpy
|
||||
|
@ -28,7 +28,7 @@ __FBSDID("$FreeBSD$");
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t
|
||||
strlcpy(char *dst, const char *src, size_t siz)
|
||||
strlcpy(char * __restrict dst, const char * __restrict src, size_t siz)
|
||||
{
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
|
Loading…
Reference in New Issue
Block a user