From 47452307073054f30f32dc9797d31ff879a6303e Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 11 Mar 2021 23:33:14 +0100 Subject: [PATCH] scanf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too. 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 Signed-off-by: Michael Kerrisk --- man3/scanf.3 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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 .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 .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