diff mbox series

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

Message ID 20210228004817.122463-7-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 getgrnam_r(), getgrgid_r().
Users might be surprised by this!  Let's use it here too!

.../glibc$ grep_glibc_prototype getgrnam_r
grp/grp.h:148:
extern int getgrnam_r (const char *__restrict __name,
		       struct group *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct group **__restrict __result);
.../glibc$ grep_glibc_prototype getgrgid_r
grp/grp.h:140:
extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct group **__restrict __result);
.../glibc$

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

Patch

diff --git a/man3/getgrnam.3 b/man3/getgrnam.3
index 87f61c260..1b13208ba 100644
--- a/man3/getgrnam.3
+++ b/man3/getgrnam.3
@@ -41,10 +41,13 @@  getgrnam, getgrnam_r, getgrgid, getgrgid_r \- get group file entry
 .BI "struct group *getgrnam(const char *" name );
 .BI "struct group *getgrgid(gid_t " gid );
 .PP
-.BI "int getgrnam_r(const char *" name ", struct group *" grp ,
-.BI "          char *" buf ", size_t " buflen ", struct group **" result );
-.BI "int getgrgid_r(gid_t " gid ", struct group *" grp ,
-.BI "          char *" buf ", size_t " buflen ", struct group **" result );
+.BI "int getgrnam_r(const char *restrict " name \
+", struct group *restrict " grp ,
+.BI "               char *restrict " buf ", size_t " buflen ,
+.BI "               struct group **restrict " result );
+.BI "int getgrgid_r(gid_t " gid ", struct group *restrict " grp ,
+.BI "               char *restrict " buf ", size_t " buflen ,
+.BI "               struct group **restrict " result );
 .fi
 .PP
 .RS -4