diff mbox series

[07/20] ctime.3: SYNOPSIS: Use 'restrict' in prototypes

Message ID 20210224144310.140649-8-alx.manpages@gmail.com
State Not Applicable
Headers show
Series None | expand

Commit Message

Alejandro Colomar \(man-pages\) Feb. 24, 2021, 2:42 p.m. UTC
POSIX does NOT specify ctime_r() to use 'restrict'.
However, glibc uses 'restrict'.
Users might be surprised by this!  Let's use it here too!

......

.../glibc$ grep_glibc_prototype ctime_r
timezone/private.h:504:
char *ctime_r(time_t const *, char *);
timezone/private.h:712:
char *ctime_r(time_t const *, char *);
time/time.h:153:
extern char *ctime_r (const time_t *__restrict __timer,
		      char *__restrict __buf) __THROW;
.../glibc$

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

Patch

diff --git a/man3/ctime.3 b/man3/ctime.3
index cd0ccc98d..7e4baa390 100644
--- a/man3/ctime.3
+++ b/man3/ctime.3
@@ -44,7 +44,7 @@  localtime_r \- transform date and time to broken-down time or ASCII
 .BI "char *asctime_r(const struct tm *restrict " tm ", char *restrict " buf );
 .PP
 .BI "char *ctime(const time_t *" timep );
-.BI "char *ctime_r(const time_t *" timep ", char *" buf );
+.BI "char *ctime_r(const time_t *restrict " timep ", char *restrict " buf );
 .PP
 .BI "struct tm *gmtime(const time_t *" timep );
 .BI "struct tm *gmtime_r(const time_t *restrict " timep ,
@@ -381,6 +381,12 @@  as obsolete,
 recommending the use of
 .BR strftime (3)
 instead.
+.PP
+POSIX doesn't specify the parameters of
+.BR ctime_r ()
+to be
+.IR restrict ;
+that is specific to glibc.
 .SH NOTES
 The four functions
 .BR asctime (),