[PATCH 03/17] unlocked_stdio.3: SYNOPSIS: Use 'restrict' in prototypes
Alejandro Colomar
alx.manpages@gmail.com
Thu Mar 11 22:33:16 GMT 2021
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>
---
man3/unlocked_stdio.3 | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/man3/unlocked_stdio.3 b/man3/unlocked_stdio.3
index 324c4fdc8..e16c5a521 100644
--- a/man3/unlocked_stdio.3
+++ b/man3/unlocked_stdio.3
@@ -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
--
2.30.1
More information about the Libc-alpha
mailing list