- Add the 'restrict' qualifier to the function definitions and

public prototypes of setbuf(3) and setvbuf(3) using the
   '__restrict' macro from <sys/cdefs.h> to be compliant with
   IEEE Std 1003.1-2001.
 - Replace the K&R with ANSI-C function definitions.
 - Bring the manual page up-to-date.
This commit is contained in:
Robert Drehmel 2002-08-14 23:45:42 +00:00
parent 620035ef89
commit 3248d0a517
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=101889
4 changed files with 6 additions and 12 deletions

View File

@ -243,8 +243,8 @@ int remove(const char *);
int rename(const char *, const char *);
void rewind(FILE *);
int scanf(const char *, ...);
void setbuf(FILE *, char *);
int setvbuf(FILE *, char *, int, size_t);
void setbuf(FILE *__restrict, char *__restrict);
int setvbuf(FILE *__restrict, char *__restrict, int, size_t);
int sprintf(char *, const char *, ...);
int sscanf(const char *, const char *, ...);
FILE *tmpfile(void);

View File

@ -50,13 +50,13 @@
.Sh SYNOPSIS
.In stdio.h
.Ft void
.Fn setbuf "FILE *stream" "char *buf"
.Fn setbuf "FILE *restrict stream" "char *restrict buf"
.Ft void
.Fn setbuffer "FILE *stream" "char *buf" "int size"
.Ft int
.Fn setlinebuf "FILE *stream"
.Ft int
.Fn setvbuf "FILE *stream" "char *buf" "int mode" "size_t size"
.Fn setvbuf "FILE *restrict stream" "char *restrict buf" "int mode" "size_t size"
.Sh DESCRIPTION
The three types of buffering available are unbuffered, block buffered,
and line buffered.

View File

@ -44,9 +44,7 @@ __FBSDID("$FreeBSD$");
#include "local.h"
void
setbuf(fp, buf)
FILE *fp;
char *buf;
setbuf(FILE *__restrict fp, char *__restrict buf)
{
(void) setvbuf(fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
}

View File

@ -52,11 +52,7 @@ __FBSDID("$FreeBSD$");
* a buffer.
*/
int
setvbuf(fp, buf, mode, size)
FILE *fp;
char *buf;
int mode;
size_t size;
setvbuf(FILE *__restrict fp, char *__restrict buf, int mode, size_t size)
{
int ret, flags;
size_t iosize;