From: Alejandro Colomar <alx.manpages@gmail.com>
To: mtk.manpages@gmail.com
Cc: Alejandro Colomar <alx.manpages@gmail.com>,
linux-man@vger.kernel.org, libc-alpha@sourceware.org
Subject: [PATCH 01/17] scanf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too.
Date: Thu, 11 Mar 2021 23:33:14 +0100 [thread overview]
Message-ID: <20210311223330.722437-2-alx.manpages@gmail.com> (raw)
In-Reply-To: <20210311223330.722437-1-alx.manpages@gmail.com>
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 --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
--
2.30.1
next prev parent reply other threads:[~2021-03-11 22:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 22:33 [PATCH 00/17] man3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
2021-03-11 22:33 ` Alejandro Colomar [this message]
2021-03-11 22:33 ` [PATCH 02/17] tsearch.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 03/17] unlocked_stdio.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 04/17] wcpcpy.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 05/17] wcpncpy.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 06/17] wcrtomb.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 07/17] wcscat.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 08/17] wcscpy.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 09/17] wcsncat.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 10/17] wcsncpy.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 11/17] wcsnrtombs.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 12/17] wcsrtombs.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 13/17] wcstoimax.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 14/17] wcstok.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 15/17] wcstombs.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 16/17] wmemcpy.3: " Alejandro Colomar
2021-03-11 22:33 ` [PATCH 17/17] wordexp.3: " Alejandro Colomar
2021-03-13 4:11 ` [PATCH 00/17] man3: " Jonathan Nieder
2021-03-13 10:41 ` Alejandro Colomar (man-pages)
2021-03-14 20:56 ` Michael Kerrisk (man-pages)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210311223330.722437-2-alx.manpages@gmail.com \
--to=alx.manpages@gmail.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox