From 4d6bf1c3fb0816347ba09c47c02f040d71c13679 Mon Sep 17 00:00:00 2001 From: mike Date: Sat, 12 Oct 2002 16:13:41 +0000 Subject: Add restrict type-qualifier. --- lib/libc/gen/pselect.3 | 2 +- lib/libc/gen/pselect.c | 5 +++-- lib/libc/stdio/fgetpos.c | 2 +- lib/libc/stdio/fgets.3 | 4 ++-- lib/libc/stdio/fopen.3 | 2 +- lib/libc/stdio/fopen.c | 4 ++-- lib/libc/stdio/fputs.c | 4 ++-- lib/libc/stdio/fread.3 | 4 ++-- lib/libc/stdio/fread.c | 4 ++-- lib/libc/stdio/freopen.c | 3 ++- lib/libc/stdio/fscanf.c | 2 +- lib/libc/stdio/fseek.3 | 2 +- lib/libc/stdio/fwrite.c | 4 ++-- lib/libc/stdio/scanf.3 | 12 ++++++------ lib/libc/stdio/scanf.c | 2 +- lib/libc/stdio/sscanf.c | 2 +- lib/libc/stdio/vscanf.c | 2 +- lib/libc/stdio/vsscanf.c | 4 ++-- 18 files changed, 33 insertions(+), 31 deletions(-) (limited to 'lib') diff --git a/lib/libc/gen/pselect.3 b/lib/libc/gen/pselect.3 index 6abb952..d09524c 100644 --- a/lib/libc/gen/pselect.3 +++ b/lib/libc/gen/pselect.3 @@ -39,7 +39,7 @@ .Sh SYNOPSIS .In sys/select.h .Ft int -.Fn pselect "int nfds" "fd_set *readfds" "fd_set *writefds" "fd_set *exceptfds" "const struct timespec *timeout" "const sigset_t *newsigmask" +.Fn pselect "int nfds" "fd_set * restrict readfds" "fd_set * restrict writefds" "fd_set * restrict exceptfds" "const struct timespec * restrict timeout" "const sigset_t * restrict newsigmask" .Sh DESCRIPTION The .Fn pselect diff --git a/lib/libc/gen/pselect.c b/lib/libc/gen/pselect.c index c2ec108..28066a2 100644 --- a/lib/libc/gen/pselect.c +++ b/lib/libc/gen/pselect.c @@ -47,8 +47,9 @@ __weak_reference(__pselect, pselect); * and allows the user to specify a signal mask to apply during the select. */ int -__pselect(int count, fd_set *rfds, fd_set *wfds, fd_set *efds, - const struct timespec *timo, const sigset_t *mask) +__pselect(int count, fd_set * __restrict rfds, fd_set * __restrict wfds, + fd_set * __restrict efds, const struct timespec * __restrict timo, + const sigset_t * __restrict mask) { sigset_t omask; struct timeval tvtimo, *tvp; diff --git a/lib/libc/stdio/fgetpos.c b/lib/libc/stdio/fgetpos.c index f5e3aae..295b20a 100644 --- a/lib/libc/stdio/fgetpos.c +++ b/lib/libc/stdio/fgetpos.c @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include int -fgetpos(FILE *fp, fpos_t *pos) +fgetpos(FILE * __restrict fp, fpos_t * __restrict pos) { /* * ftello is thread-safe; no need to lock fp. diff --git a/lib/libc/stdio/fgets.3 b/lib/libc/stdio/fgets.3 index e536b21..7a63039 100644 --- a/lib/libc/stdio/fgets.3 +++ b/lib/libc/stdio/fgets.3 @@ -48,7 +48,7 @@ .Sh SYNOPSIS .In stdio.h .Ft char * -.Fn fgets "char *str" "int size" "FILE *stream" +.Fn fgets "char * restrict str" "int size" "FILE * restrict stream" .Ft char * .Fn gets "char *str" .Sh DESCRIPTION @@ -163,4 +163,4 @@ The functions and .Fn gets conform to -.St -isoC . +.St -isoC-99 . diff --git a/lib/libc/stdio/fopen.3 b/lib/libc/stdio/fopen.3 index f4c1f34..a4614d7 100644 --- a/lib/libc/stdio/fopen.3 +++ b/lib/libc/stdio/fopen.3 @@ -49,7 +49,7 @@ .Sh SYNOPSIS .In stdio.h .Ft FILE * -.Fn fopen "const char *path" "const char *mode" +.Fn fopen "const char * restrict path" "const char * restrict mode" .Ft FILE * .Fn fdopen "int fildes" "const char *mode" .Ft FILE * diff --git a/lib/libc/stdio/fopen.c b/lib/libc/stdio/fopen.c index 7af0636..b7c84a7 100644 --- a/lib/libc/stdio/fopen.c +++ b/lib/libc/stdio/fopen.c @@ -52,8 +52,8 @@ __FBSDID("$FreeBSD$"); FILE * fopen(file, mode) - const char *file; - const char *mode; + const char * __restrict file; + const char * __restrict mode; { FILE *fp; int f; diff --git a/lib/libc/stdio/fputs.c b/lib/libc/stdio/fputs.c index e209659..812c37d 100644 --- a/lib/libc/stdio/fputs.c +++ b/lib/libc/stdio/fputs.c @@ -53,8 +53,8 @@ __FBSDID("$FreeBSD$"); */ int fputs(s, fp) - const char *s; - FILE *fp; + const char * __restrict s; + FILE * __restrict fp; { int retval; struct __suio uio; diff --git a/lib/libc/stdio/fread.3 b/lib/libc/stdio/fread.3 index 6d4a79c..925ef61 100644 --- a/lib/libc/stdio/fread.3 +++ b/lib/libc/stdio/fread.3 @@ -48,9 +48,9 @@ .Sh SYNOPSIS .In stdio.h .Ft size_t -.Fn fread "void *ptr" "size_t size" "size_t nmemb" "FILE *stream" +.Fn fread "void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream" .Ft size_t -.Fn fwrite "const void *ptr" "size_t size" "size_t nmemb" "FILE *stream" +.Fn fwrite "const void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream" .Sh DESCRIPTION The function .Fn fread diff --git a/lib/libc/stdio/fread.c b/lib/libc/stdio/fread.c index 39c1a8c..73c7c19 100644 --- a/lib/libc/stdio/fread.c +++ b/lib/libc/stdio/fread.c @@ -49,9 +49,9 @@ __FBSDID("$FreeBSD$"); size_t fread(buf, size, count, fp) - void *buf; + void * __restrict buf; size_t size, count; - FILE *fp; + FILE * __restrict fp; { size_t resid; char *p; diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c index c885673..b445b15 100644 --- a/lib/libc/stdio/freopen.c +++ b/lib/libc/stdio/freopen.c @@ -59,7 +59,8 @@ __FBSDID("$FreeBSD$"); */ FILE * freopen(file, mode, fp) - const char *file, *mode; + const char * __restrict file; + const char * __restrict mode; FILE *fp; { int f; diff --git a/lib/libc/stdio/fscanf.c b/lib/libc/stdio/fscanf.c index 1c376a8..ea76af2 100644 --- a/lib/libc/stdio/fscanf.c +++ b/lib/libc/stdio/fscanf.c @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" int -fscanf(FILE *fp, char const *fmt, ...) +fscanf(FILE * __restrict fp, char const * __restrict fmt, ...) { int ret; va_list ap; diff --git a/lib/libc/stdio/fseek.3 b/lib/libc/stdio/fseek.3 index 6326751..f2ca10f 100644 --- a/lib/libc/stdio/fseek.3 +++ b/lib/libc/stdio/fseek.3 @@ -59,7 +59,7 @@ .Ft void .Fn rewind "FILE *stream" .Ft int -.Fn fgetpos "FILE *stream" "fpos_t *pos" +.Fn fgetpos "FILE * restrict stream" "fpos_t * restrict pos" .Ft int .Fn fsetpos "FILE *stream" "const fpos_t *pos" .In sys/types.h diff --git a/lib/libc/stdio/fwrite.c b/lib/libc/stdio/fwrite.c index 445baec..0a74d81 100644 --- a/lib/libc/stdio/fwrite.c +++ b/lib/libc/stdio/fwrite.c @@ -53,9 +53,9 @@ __FBSDID("$FreeBSD$"); */ size_t fwrite(buf, size, count, fp) - const void *buf; + const void * __restrict buf; size_t size, count; - FILE *fp; + FILE * __restrict fp; { size_t n; struct __suio uio; diff --git a/lib/libc/stdio/scanf.3 b/lib/libc/stdio/scanf.3 index af7cc18..ea99c0e 100644 --- a/lib/libc/stdio/scanf.3 +++ b/lib/libc/stdio/scanf.3 @@ -52,18 +52,18 @@ .Sh SYNOPSIS .In stdio.h .Ft int -.Fn scanf "const char *format" ... +.Fn scanf "const char * restrict format" ... .Ft int -.Fn fscanf "FILE *stream" "const char *format" ... +.Fn fscanf "FILE * restrict stream" "const char * restrict format" ... .Ft int -.Fn sscanf "const char *str" "const char *format" ... +.Fn sscanf "const char * restrict str" "const char * restrict format" ... .In stdarg.h .Ft int -.Fn vscanf "const char *format" "va_list ap" +.Fn vscanf "const char * restrict format" "va_list ap" .Ft int -.Fn vsscanf "const char *str" "const char *format" "va_list ap" +.Fn vsscanf "const char * restrict str" "const char * restrict format" "va_list ap" .Ft int -.Fn vfscanf "FILE *stream" "const char *format" "va_list ap" +.Fn vfscanf "FILE * restrict stream" "const char * restrict format" "va_list ap" .Sh DESCRIPTION The .Fn scanf diff --git a/lib/libc/stdio/scanf.c b/lib/libc/stdio/scanf.c index 990c9b0..929c20b 100644 --- a/lib/libc/stdio/scanf.c +++ b/lib/libc/stdio/scanf.c @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" int -scanf(char const *fmt, ...) +scanf(char const * __restrict fmt, ...) { int ret; va_list ap; diff --git a/lib/libc/stdio/sscanf.c b/lib/libc/stdio/sscanf.c index d988326..4db0d29 100644 --- a/lib/libc/stdio/sscanf.c +++ b/lib/libc/stdio/sscanf.c @@ -59,7 +59,7 @@ eofread(cookie, buf, len) } int -sscanf(const char *str, char const *fmt, ...) +sscanf(const char * __restrict str, char const * __restrict fmt, ...) { int ret; va_list ap; diff --git a/lib/libc/stdio/vscanf.c b/lib/libc/stdio/vscanf.c index 92f55fc..c3a4266 100644 --- a/lib/libc/stdio/vscanf.c +++ b/lib/libc/stdio/vscanf.c @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); int vscanf(fmt, ap) - const char *fmt; + const char * __restrict fmt; __va_list ap; { int retval; diff --git a/lib/libc/stdio/vsscanf.c b/lib/libc/stdio/vsscanf.c index 81a241c..40d4947 100644 --- a/lib/libc/stdio/vsscanf.c +++ b/lib/libc/stdio/vsscanf.c @@ -60,8 +60,8 @@ eofread(cookie, buf, len) int vsscanf(str, fmt, ap) - const char *str; - const char *fmt; + const char * __restrict str; + const char * __restrict fmt; __va_list ap; { FILE f; -- cgit v1.1