diff mbox series

[14/14] getpwnam.3: SYNOPSIS: Use 'restrict' in prototypes

Message ID 20210228004817.122463-15-alx.manpages@gmail.com
State Not Applicable
Headers show
Series man3: SYNOPSIS: Use 'restrict' in prototypes (batch 2) | expand

Commit Message

Alejandro Colomar \(man-pages\) Feb. 28, 2021, 12:48 a.m. UTC
POSIX does NOT specify these functions to use 'restrict'.
However, glibc uses 'restrict' in getpwnam_r(), getpwuid_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getpwnam_r
pwd/pwd.h:151:
extern int getpwnam_r (const char *__restrict __name,
		       struct passwd *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct passwd **__restrict __result)
		       __nonnull ((1, 2, 3, 5));
.../glibc$ grep_glibc_prototype getpwuid_r
pwd/pwd.h:145:
extern int getpwuid_r (__uid_t __uid,
		       struct passwd *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct passwd **__restrict __result)
		       __nonnull ((2, 3, 5));
.../glibc$

Cc: glibc <libc-alpha@sourceware.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/getpwnam.3 | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/man3/getpwnam.3 b/man3/getpwnam.3
index 45fde871d..1eed77c45 100644
--- a/man3/getpwnam.3
+++ b/man3/getpwnam.3
@@ -45,10 +45,13 @@  getpwnam, getpwnam_r, getpwuid, getpwuid_r \- get password file entry
 .BI "struct passwd *getpwnam(const char *" name );
 .BI "struct passwd *getpwuid(uid_t " uid );
 .PP
-.BI "int getpwnam_r(const char *" name ", struct passwd *" pwd ,
-.BI "               char *" buf ", size_t " buflen ", struct passwd **" result );
-.BI "int getpwuid_r(uid_t " uid ", struct passwd *" pwd ,
-.BI "               char *" buf ", size_t " buflen ", struct passwd **" result );
+.BI "int getpwnam_r(const char *restrict " name \
+", struct passwd *restrict " pwd ,
+.BI "               char *restrict " buf ", size_t " buflen ,
+.BI "               struct passwd **restrict " result );
+.BI "int getpwuid_r(uid_t " uid ", struct passwd *restrict " pwd ,
+.BI "               char *restrict " buf ", size_t " buflen ,
+.BI "               struct passwd **restrict " result );
 .fi
 .PP
 .RS -4