[21/22] printf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too
Commit Message
Both POSIX and glibc use 'restrict' in printf(), fprintf(),
dprintf(), sprintf(), snprintf(), vprintf(), vfprintf(),
vdprintf(), vsprintf(), vsnprintf().
Let's use it here too.
.../glibc$ grep_glibc_prototype printf
libio/stdio.h:332:
extern int printf (const char *__restrict __format, ...);
.../glibc$ grep_glibc_prototype fprintf
libio/stdio.h:326:
extern int fprintf (FILE *__restrict __stream,
const char *__restrict __format, ...);
.../glibc$ grep_glibc_prototype dprintf
libio/stdio.h:382:
extern int dprintf (int __fd, const char *__restrict __fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
.../glibc$ grep_glibc_prototype sprintf
libio/stdio.h:334:
extern int sprintf (char *__restrict __s,
const char *__restrict __format, ...) __THROWNL;
.../glibc$ grep_glibc_prototype snprintf
libio/stdio.h:354:
extern int snprintf (char *__restrict __s, size_t __maxlen,
const char *__restrict __format, ...)
__THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
.../glibc$ grep_glibc_prototype vprintf
libio/stdio.h:347:
extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
.../glibc$ grep_glibc_prototype vfprintf
libio/stdio.h:341:
extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
__gnuc_va_list __arg);
.../glibc$ grep_glibc_prototype vdprintf
libio/stdio.h:379:
extern int vdprintf (int __fd, const char *__restrict __fmt,
__gnuc_va_list __arg)
__attribute__ ((__format__ (__printf__, 2, 0)));
.../glibc$ grep_glibc_prototype vsprintf
libio/stdio.h:349:
extern int vsprintf (char *__restrict __s, const char *__restrict __format,
__gnuc_va_list __arg) __THROWNL;
.../glibc$ grep_glibc_prototype vsnprintf
libio/stdio.h:358:
extern int vsnprintf (char *__restrict __s, size_t __maxlen,
const char *__restrict __format, __gnuc_va_list __arg)
__THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
.../glibc$
ffix: Align common parameters.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
man3/printf.3 | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
@@ -39,20 +39,27 @@ vsprintf, vsnprintf \- formatted output conversion
.nf
.B #include <stdio.h>
.PP
-.BI "int printf(const char *" format ", ...);"
-.BI "int fprintf(FILE *" stream ", const char *" format ", ...);"
-.BI "int dprintf(int " fd ", const char *" format ", ...);"
-.BI "int sprintf(char *" str ", const char *" format ", ...);"
-.BI "int snprintf(char *" str ", size_t " size ", const char *" format ", ...);"
+.BI "int printf(const char *restrict " format ", ...);"
+.BI "int fprintf(FILE *restrict " stream ,
+.BI " const char *restrict " format ", ...);"
+.BI "int dprintf(int " fd ,
+.BI " const char *restrict " format ", ...);"
+.BI "int sprintf(char *restrict " str ,
+.BI " const char *restrict " format ", ...);"
+.BI "int snprintf(char *restrict " str ", size_t " size ,
+.BI " const char *restrict " format ", ...);"
.PP
.B #include <stdarg.h>
.PP
-.BI "int vprintf(const char *" format ", va_list " ap );
-.BI "int vfprintf(FILE *" stream ", const char *" format ", va_list " ap );
-.BI "int vdprintf(int " fd ", const char *" format ", va_list " ap );
-.BI "int vsprintf(char *" str ", const char *" format ", va_list " ap );
-.BI "int vsnprintf(char *" str ", size_t " size ", const char *" format \
-", va_list " ap );
+.BI "int vprintf(const char *restrict " format ", va_list " ap );
+.BI "int vfprintf(FILE *restrict " stream ,
+.BI " const char *restrict " format ", va_list " ap );
+.BI "int vdprintf(int " fd ,
+.BI " const char *restrict " format ", va_list " ap );
+.BI "int vsprintf(char *restrict " str ,
+.BI " const char *restrict " format ", va_list " ap );
+.BI "int vsnprintf(char *restrict " str ", size_t " size ,
+.BI " const char *restrict " format ", va_list " ap );
.fi
.PP
.RS -4