diff mbox series

[01/17] scanf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too.

Message ID 20210311223330.722437-2-alx.manpages@gmail.com
State New
Headers show
Series man3: SYNOPSIS: Use 'restrict' in prototypes | expand

Commit Message

Alejandro Colomar March 11, 2021, 10:33 p.m. UTC
Both POSIX and glibc use 'restrict' in scanf(), fscanf(), sscanf(), vscanf(), vfscanf(), vsscanf().
Let's use it here too.

.../glibc$ grep_glibc_prototype scanf
libio/stdio.h:397:
extern int scanf (const char *__restrict __format, ...) __wur;
.../glibc$ grep_glibc_prototype fscanf
libio/stdio.h:391:
extern int fscanf (FILE *__restrict __stream,
		   const char *__restrict __format, ...) __wur;
.../glibc$ grep_glibc_prototype sscanf
libio/stdio.h:399:
extern int sscanf (const char *__restrict __s,
		   const char *__restrict __format, ...) __THROW;
.../glibc$ grep_glibc_prototype vscanf
libio/stdio.h:443:
extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
     __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
.../glibc$ grep_glibc_prototype vfscanf
libio/stdio.h:435:
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
		    __gnuc_va_list __arg)
     __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
.../glibc$ grep_glibc_prototype vsscanf
libio/stdio.h:447:
extern int vsscanf (const char *__restrict __s,
		    const char *__restrict __format, __gnuc_va_list __arg)
     __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
.../glibc$

Also reorder v* functions to match the order of non-v functions.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/scanf.3 | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/man3/scanf.3 b/man3/scanf.3
index f353f1d4d..aefc262ab 100644
--- a/man3/scanf.3
+++ b/man3/scanf.3
@@ -56,15 +56,19 @@  scanf, fscanf, sscanf, vscanf, vsscanf, vfscanf \- input format conversion
 .nf
 .B #include <stdio.h>
 .PP
-.BI "int scanf(const char *" format ", ...);"
-.BI "int fscanf(FILE *" stream ", const char *" format ", ...);"
-.BI "int sscanf(const char *" str ", const char *" format ", ...);"
+.BI "int scanf(const char *restrict " format ", ...);"
+.BI "int fscanf(FILE *restrict " stream ,
+.BI "           const char *restrict " format ", ...);"
+.BI "int sscanf(const char *restrict " str ,
+.BI "           const char *restrict " format ", ...);"
 .PP
 .B #include <stdarg.h>
 .PP
-.BI "int vscanf(const char *" format ", va_list " ap );
-.BI "int vsscanf(const char *" str ", const char *" format ", va_list " ap );
-.BI "int vfscanf(FILE *" stream ", const char *" format ", va_list " ap );
+.BI "int vscanf(const char *restrict " format ", va_list " ap );
+.BI "int vfscanf(FILE *restrict " stream ,
+.BI "           const char *restrict " format ", va_list " ap );
+.BI "int vsscanf(const char *restrict " str ,
+.BI "           const char *restrict " format ", va_list " ap );
 .fi
 .PP
 .RS -4