- Add the 'restrict' qualifier to the definitions of the string

concatenation and copy functions using the '__restrict' macro.
   This is to satisfy IEEE Std 1003-1.2001.
 - Use ANSI-C function definitions.
 - Add the 'restrict' keyword to the manual pages, too.
This commit is contained in:
Robert Drehmel 2002-08-14 22:59:22 +00:00
parent d542f511a0
commit ad90696815
6 changed files with 8 additions and 18 deletions

View File

@ -47,9 +47,9 @@
.Sh SYNOPSIS
.In string.h
.Ft char *
.Fn strcat "char *s" "const char *append"
.Fn strcat "char *restrict s" "const char *restrict append"
.Ft char *
.Fn strncat "char *s" "const char *append" "size_t count"
.Fn strncat "char *restrict s" "const char *restrict append" "size_t count"
.Sh DESCRIPTION
The
.Fn strcat

View File

@ -40,9 +40,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
char *
strcat(s, append)
char *s;
const char *append;
strcat(char *__restrict s, const char *__restrict append)
{
char *save = s;

View File

@ -47,9 +47,9 @@
.Sh SYNOPSIS
.In string.h
.Ft char *
.Fn strcpy "char *dst" "const char *src"
.Fn strcpy "char *restrict dst" "const char *restrict src"
.Ft char *
.Fn strncpy "char *dst" "const char *src" "size_t len"
.Fn strncpy "char *restrict dst" "const char *restrict src" "size_t len"
.Sh DESCRIPTION
The
.Fn strcpy

View File

@ -40,9 +40,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
char *
strcpy(to, from)
char *to;
const char *from;
strcpy(char *__restrict to, const char *__restrict from)
{
char *save = to;

View File

@ -47,10 +47,7 @@ __FBSDID("$FreeBSD$");
* are written at dst (at most n+1 bytes being appended). Return dst.
*/
char *
strncat(dst, src, n)
char *dst;
const char *src;
size_t n;
strncat(char *__restrict dst, const char *__restrict src, size_t n)
{
if (n != 0) {
char *d = dst;

View File

@ -47,10 +47,7 @@ __FBSDID("$FreeBSD$");
* Return dst.
*/
char *
strncpy(dst, src, n)
char *dst;
const char *src;
size_t n;
strncpy(char *__restrict dst, const char *__restrict src, size_t n)
{
if (n != 0) {
char *d = dst;