unlocked_stdio.3: SYNOPSIS: Use 'restrict' in prototypes

glibc uses 'restrict' in fread_unlocked(), fwrite_unlocked(), fgets_unlocked(), fputs_unlocked(), fgetws_unlocked(), fputws_unlocked().
Let's use it here too.

.../glibc$ grep_glibc_prototype fread_unlocked
libio/stdio.h:678:
extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
			      size_t __n, FILE *__restrict __stream) __wur;
.../glibc$ grep_glibc_prototype fwrite_unlocked
libio/stdio.h:680:
extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
			       size_t __n, FILE *__restrict __stream);
.../glibc$ grep_glibc_prototype fgets_unlocked
libio/stdio.h:591:
extern char *fgets_unlocked (char *__restrict __s, int __n,
			     FILE *__restrict __stream) __wur
    __attr_access ((__write_only__, 1, 2));
.../glibc$ grep_glibc_prototype fputs_unlocked
libio/stdio.h:667:
extern int fputs_unlocked (const char *__restrict __s,
			   FILE *__restrict __stream);
.../glibc$ grep_glibc_prototype fgetws_unlocked
wcsmbs/wchar.h:820:
extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
				 __FILE *__restrict __stream);
.../glibc$ grep_glibc_prototype fputws_unlocked
wcsmbs/wchar.h:829:
extern int fputws_unlocked (const wchar_t *__restrict __ws,
			    __FILE *__restrict __stream);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Alejandro Colomar 2021-03-11 23:33:16 +01:00 committed by Michael Kerrisk
parent c0828478b0
commit 586c5b22e8
1 changed files with 12 additions and 8 deletions

View File

@ -44,13 +44,15 @@ putchar_unlocked \- nonlocking stdio functions
.BI "int fgetc_unlocked(FILE *" stream );
.BI "int fputc_unlocked(int " c ", FILE *" stream );
.PP
.BI "size_t fread_unlocked(void *" ptr ", size_t " size ", size_t " n ,
.BI " FILE *" stream );
.BI "size_t fwrite_unlocked(const void *" ptr ", size_t " size ", size_t " n ,
.BI " FILE *" stream );
.BI "size_t fread_unlocked(void *restrict " ptr ", size_t " size ", size_t " n ,
.BI " FILE *restrict " stream );
.BI "size_t fwrite_unlocked(const void *restrict " ptr ", size_t " size \
", size_t " n ,
.BI " FILE *restrict " stream );
.PP
.BI "char *fgets_unlocked(char *" s ", int " n ", FILE *" stream );
.BI "int fputs_unlocked(const char *" s ", FILE *" stream );
.BI "char *fgets_unlocked(char *restrict " s ", int " n \
", FILE *restrict " stream );
.BI "int fputs_unlocked(const char *restrict " s ", FILE *restrict " stream );
.PP
.B #include <wchar.h>
.PP
@ -62,8 +64,10 @@ putchar_unlocked \- nonlocking stdio functions
.BI "wint_t putwc_unlocked(wchar_t " wc ", FILE *" stream );
.BI "wint_t putwchar_unlocked(wchar_t " wc );
.PP
.BI "wchar_t *fgetws_unlocked(wchar_t *" ws ", int " n ", FILE *" stream );
.BI "int fputws_unlocked(const wchar_t *" ws ", FILE *" stream );
.BI "wchar_t *fgetws_unlocked(wchar_t *restrict " ws ", int " n ,
.BI " FILE *restrict " stream );
.BI "int fputws_unlocked(const wchar_t *restrict " ws ,
.BI " FILE *restrict " stream );
.fi
.PP
.RS -4