wprintf.3: SYNOPSIS: Use 'restrict' in prototypes

Message ID 20210313150651.163299-1-alx.manpages@gmail.com
State Not applicable
Headers
Series wprintf.3: SYNOPSIS: Use 'restrict' in prototypes |

Commit Message

Alejandro Colomar March 13, 2021, 3:06 p.m. UTC
  POSIX uses 'restrict' in *wprintf() (see [v]fwprintf(3p)).
Let's use it here too.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---

Hi Michael,

I found this last one, which I didn't find through the glibc sources
because they have a bit of a mess with *printf() functions.
I checked that POSIX requires 'restrict'.

At this point, I still have a few patches about prototypes (not restrict),
but I'll buffer them for now.

Cheers,

Alex

 man3/wprintf.3 | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
  

Comments

Michael Kerrisk \(man-pages\) March 14, 2021, 9:38 p.m. UTC | #1
Hello Alex,

On 3/13/21 4:06 PM, Alejandro Colomar wrote:
> POSIX uses 'restrict' in *wprintf() (see [v]fwprintf(3p)).
> Let's use it here too.

Thanks! Patch applied.

Cheers,

Michael

> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
> ---
> 
> Hi Michael,
> 
> I found this last one, which I didn't find through the glibc sources
> because they have a bit of a mess with *printf() functions.
> I checked that POSIX requires 'restrict'.
> 
> At this point, I still have a few patches about prototypes (not restrict),
> but I'll buffer them for now.
> 
> Cheers,
> 
> Alex
> 
>  man3/wprintf.3 | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/man3/wprintf.3 b/man3/wprintf.3
> index 676fe1ed7..76acfbb34 100644
> --- a/man3/wprintf.3
> +++ b/man3/wprintf.3
> @@ -22,15 +22,17 @@ wide-character output conversion
>  .B #include <stdio.h>
>  .B #include <wchar.h>
>  .PP
> -.BI "int wprintf(const wchar_t *" format ", ...);"
> -.BI "int fwprintf(FILE *" stream ", const wchar_t *" format ", ...);"
> -.BI "int swprintf(wchar_t *" wcs ", size_t " maxlen ,
> -.BI "             const wchar_t *" format ", ...);"
> +.BI "int wprintf(const wchar_t *restrict " format ", ...);"
> +.BI "int fwprintf(FILE *restrict " stream ,
> +.BI "             const wchar_t *restrict " format ", ...);"
> +.BI "int swprintf(wchar_t *restrict " wcs ", size_t " maxlen ,
> +.BI "             const wchar_t *restrict " format ", ...);"
>  .PP
> -.BI "int vwprintf(const wchar_t *" format ", va_list " args );
> -.BI "int vfwprintf(FILE *" stream ", const wchar_t *" format ", va_list " args );
> -.BI "int vswprintf(wchar_t *" wcs ", size_t " maxlen ,
> -.BI "             const wchar_t *" format ", va_list " args );
> +.BI "int vwprintf(const wchar_t *restrict " format ", va_list " args );
> +.BI "int vfwprintf(FILE *restrict " stream ,
> +.BI "             const wchar_t *restrict " format ", va_list " args );
> +.BI "int vswprintf(wchar_t *restrict " wcs ", size_t " maxlen ,
> +.BI "             const wchar_t *restrict " format ", va_list " args );
>  .fi
>  .PP
>  .RS -4
>
  

Patch

diff --git a/man3/wprintf.3 b/man3/wprintf.3
index 676fe1ed7..76acfbb34 100644
--- a/man3/wprintf.3
+++ b/man3/wprintf.3
@@ -22,15 +22,17 @@  wide-character output conversion
 .B #include <stdio.h>
 .B #include <wchar.h>
 .PP
-.BI "int wprintf(const wchar_t *" format ", ...);"
-.BI "int fwprintf(FILE *" stream ", const wchar_t *" format ", ...);"
-.BI "int swprintf(wchar_t *" wcs ", size_t " maxlen ,
-.BI "             const wchar_t *" format ", ...);"
+.BI "int wprintf(const wchar_t *restrict " format ", ...);"
+.BI "int fwprintf(FILE *restrict " stream ,
+.BI "             const wchar_t *restrict " format ", ...);"
+.BI "int swprintf(wchar_t *restrict " wcs ", size_t " maxlen ,
+.BI "             const wchar_t *restrict " format ", ...);"
 .PP
-.BI "int vwprintf(const wchar_t *" format ", va_list " args );
-.BI "int vfwprintf(FILE *" stream ", const wchar_t *" format ", va_list " args );
-.BI "int vswprintf(wchar_t *" wcs ", size_t " maxlen ,
-.BI "             const wchar_t *" format ", va_list " args );
+.BI "int vwprintf(const wchar_t *restrict " format ", va_list " args );
+.BI "int vfwprintf(FILE *restrict " stream ,
+.BI "             const wchar_t *restrict " format ", va_list " args );
+.BI "int vswprintf(wchar_t *restrict " wcs ", size_t " maxlen ,
+.BI "             const wchar_t *restrict " format ", va_list " args );
 .fi
 .PP
 .RS -4