Add restrict type-qualifier.
This commit is contained in:
parent
ca8c4bef3b
commit
4d6bf1c3fb
@ -72,8 +72,7 @@ int sigismember(const sigset_t *, int);
|
||||
int sigpending(sigset_t *);
|
||||
int sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict);
|
||||
int sigsuspend(const sigset_t *);
|
||||
/* XXX missing restrict qualifier. */
|
||||
int sigwait(const sigset_t *, int *);
|
||||
int sigwait(const sigset_t * __restrict, int * __restrict);
|
||||
#endif
|
||||
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 600
|
||||
|
@ -210,10 +210,6 @@ __END_DECLS
|
||||
__BEGIN_DECLS
|
||||
/*
|
||||
* Functions defined in ANSI C standard.
|
||||
*
|
||||
* XXX fgetpos(), fgets(), fopen(), fputs(), fread(), freopen(), fscanf(),
|
||||
* fwrite(), scanf(), sscanf(), vscanf(), and vsscanf() are missing the
|
||||
* restrict type-qualifier.
|
||||
*/
|
||||
void clearerr(FILE *);
|
||||
int fclose(FILE *);
|
||||
@ -221,19 +217,19 @@ int feof(FILE *);
|
||||
int ferror(FILE *);
|
||||
int fflush(FILE *);
|
||||
int fgetc(FILE *);
|
||||
int fgetpos(FILE *, fpos_t *);
|
||||
char *fgets(char *, int, FILE *);
|
||||
FILE *fopen(const char *, const char *);
|
||||
int fgetpos(FILE * __restrict, fpos_t * __restrict);
|
||||
char *fgets(char * __restrict, int, FILE * __restrict);
|
||||
FILE *fopen(const char * __restrict, const char * __restrict);
|
||||
int fprintf(FILE * __restrict, const char * __restrict, ...);
|
||||
int fputc(int, FILE *);
|
||||
int fputs(const char *, FILE *);
|
||||
size_t fread(void *, size_t, size_t, FILE *);
|
||||
FILE *freopen(const char *, const char *, FILE *);
|
||||
int fscanf(FILE *, const char *, ...);
|
||||
int fputs(const char * __restrict, FILE * __restrict);
|
||||
size_t fread(void * __restrict, size_t, size_t, FILE * __restrict);
|
||||
FILE *freopen(const char * __restrict, const char * __restrict, FILE * __restrict);
|
||||
int fscanf(FILE * __restrict, const char * __restrict, ...);
|
||||
int fseek(FILE *, long, int);
|
||||
int fsetpos(FILE *, const fpos_t *);
|
||||
long ftell(FILE *);
|
||||
size_t fwrite(const void *, size_t, size_t, FILE *);
|
||||
size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
|
||||
int getc(FILE *);
|
||||
int getchar(void);
|
||||
char *gets(char *);
|
||||
@ -245,11 +241,11 @@ int puts(const char *);
|
||||
int remove(const char *);
|
||||
int rename(const char *, const char *);
|
||||
void rewind(FILE *);
|
||||
int scanf(const char *, ...);
|
||||
int scanf(const char * __restrict, ...);
|
||||
void setbuf(FILE * __restrict, char * __restrict);
|
||||
int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
|
||||
int sprintf(char * __restrict, const char * __restrict, ...);
|
||||
int sscanf(const char *, const char *, ...);
|
||||
int sscanf(const char * __restrict, const char * __restrict, ...);
|
||||
FILE *tmpfile(void);
|
||||
char *tmpnam(char *);
|
||||
int ungetc(int, FILE *);
|
||||
@ -262,10 +258,10 @@ int vsprintf(char * __restrict, const char * __restrict,
|
||||
#if __ISO_C_VISIBLE >= 1999
|
||||
int snprintf(char * __restrict, size_t, const char * __restrict,
|
||||
...) __printflike(3, 4);
|
||||
int vscanf(const char *, __va_list) __scanflike(1, 0);
|
||||
int vscanf(const char * __restrict, __va_list) __scanflike(1, 0);
|
||||
int vsnprintf(char * __restrict, size_t, const char * __restrict,
|
||||
__va_list) __printflike(3, 0);
|
||||
int vsscanf(const char *, const char *, __va_list)
|
||||
int vsscanf(const char * __restrict, const char * __restrict, __va_list)
|
||||
__scanflike(2, 0);
|
||||
|
||||
/*
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
fgetpos(FILE *fp, fpos_t *pos)
|
||||
fgetpos(FILE * __restrict fp, fpos_t * __restrict pos)
|
||||
{
|
||||
/*
|
||||
* ftello is thread-safe; no need to lock fp.
|
||||
|
@ -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 .
|
||||
|
@ -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 *
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
int
|
||||
vscanf(fmt, ap)
|
||||
const char *fmt;
|
||||
const char * __restrict fmt;
|
||||
__va_list ap;
|
||||
{
|
||||
int retval;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user