[PATCH 15/24] string.3: SYNOPSIS: Use 'restrict' in prototypes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Both POSIX and glibc use 'restrict' in stpcpy(), strcat(), strcpy(), strncat(), strncpy(), strtok(), strxfrm().
Let's use it here too.

.../glibc$ grep_glibc_prototype stpcpy
string/string.h:475:
extern char *stpcpy (char *__restrict __dest, const char *__restrict __src)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype strcat
string/string.h:133:
extern char *strcat (char *__restrict __dest, const char *__restrict __src)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype strcpy
string/string.h:125:
extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype strncat
string/string.h:136:
extern char *strncat (char *__restrict __dest, const char *__restrict __src,
		      size_t __n) __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype strncpy
string/string.h:128:
extern char *strncpy (char *__restrict __dest,
		      const char *__restrict __src, size_t __n)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype strtok
string/string.h:340:
extern char *strtok (char *__restrict __s, const char *__restrict __delim)
     __THROW __nonnull ((2));
.../glibc$ grep_glibc_prototype strxfrm
string/string.h:150:
extern size_t strxfrm (char *__restrict __dest,
		       const char *__restrict __src, size_t __n)
    __THROW __nonnull ((2)) __attr_access ((__write_only__, 1, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@xxxxxxxxx>
---
 man3/string.3 | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/man3/string.3 b/man3/string.3
index ab4cc3ce7..06da21c28 100644
--- a/man3/string.3
+++ b/man3/string.3
@@ -66,7 +66,7 @@ in the string
 .TP
 .B #include <string.h>
 .TP
-.BI "char *stpcpy(char *" dest ", const char *" src );
+.BI "char *stpcpy(char *restrict " dest ", const char *restrict " src );
 Copy a string from
 .I src
 to
@@ -74,7 +74,7 @@ to
 returning a pointer to the end of the resulting string at
 .IR dest .
 .TP
-.BI "char *strcat(char *" dest ", const char *" src );
+.BI "char *strcat(char *restrict " dest ", const char *restrict " src );
 Append the string
 .I src
 to the string
@@ -101,7 +101,7 @@ with
 .I s2
 using the current locale.
 .TP
-.BI "char *strcpy(char *" dest ", const char *" src );
+.BI "char *strcpy(char *restrict " dest ", const char *restrict " src );
 Copy the string
 .I src
 to
@@ -129,7 +129,8 @@ Randomly swap the characters in
 Return the length of the string
 .IR s .
 .TP
-.BI "char *strncat(char *" dest ", const char *" src ", size_t " n );
+.BI "char *strncat(char *restrict " dest ", const char *restrict " src \
+", size_t " n );
 Append at most
 .I n
 bytes from the string
@@ -147,7 +148,8 @@ bytes of the strings
 and
 .IR s2 .
 .TP
-.BI "char *strncpy(char *" dest ", const char *" src ", size_t " n );
+.BI "char *strncpy(char *restrict " dest ", const char *restrict " src \
+", size_t " n );
 Copy at most
 .I n
 bytes from string
@@ -188,19 +190,20 @@ in the string
 .IR haystack ,
 returning a pointer to the found substring.
 .TP
-.BI "char *strtok(char *" s ", const char *" delim );
+.BI "char *strtok(char *restrict " s ", const char *restrict " delim );
 Extract tokens from the string
 .I s
 that are delimited by one of the bytes in
 .IR delim .
 .TP
-.BI "size_t strxfrm(char *" dest ", const char *" src ", size_t " n );
+.BI "size_t strxfrm(char *restrict " dst ", const char *restrict " src \
+", size_t " n );
 Transforms
 .I src
 to the current locale and copies the first
 .I n
 bytes to
-.IR dest .
+.IR dst .
 .SH DESCRIPTION
 The string functions perform operations on null-terminated
 strings.
-- 
2.30.1.721.g45526154a5




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux