From dfcdc8688bae31262c9d05201a9ffd2443e8b65f Mon Sep 17 00:00:00 2001 From: Peter Avalos Date: Fri, 16 Jan 2009 21:22:40 -0500 Subject: [PATCH] Add the restrict qualifier to strftime(3) and strptime(3). --- include/time.h | 6 ++++-- lib/libc/stdtime/strftime.c | 4 ++-- lib/libc/stdtime/strptime.c | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/time.h b/include/time.h index 26ededc8ba..5f0fd77201 100644 --- a/include/time.h +++ b/include/time.h @@ -144,7 +144,8 @@ double difftime (time_t, time_t); struct tm *gmtime (const time_t *); struct tm *localtime (const time_t *); time_t mktime (struct tm *); -size_t strftime (char *, size_t, const char *, const struct tm *); +size_t strftime (char * __restrict, size_t, const char * __restrict, + const struct tm * __restrict); time_t time (time_t *); #if __POSIX_VISIBLE @@ -169,7 +170,8 @@ int nanosleep (const struct timespec *, struct timespec *); #if __XSI_VISIBLE extern int daylight; extern long timezone; -char *strptime (const char *, const char *, struct tm *); +char *strptime (const char * __restrict, const char * __restrict, + struct tm * __restrict); #endif #if __BSD_VISIBLE diff --git a/lib/libc/stdtime/strftime.c b/lib/libc/stdtime/strftime.c index 5b5cde8423..3fe24b67d6 100644 --- a/lib/libc/stdtime/strftime.c +++ b/lib/libc/stdtime/strftime.c @@ -81,8 +81,8 @@ static char * _yconv(int, int, int, int, char *, const char *); #define IN_ALL 3 size_t -strftime(char * const s, const size_t maxsize, const char * const format, - const struct tm * const t) +strftime(char * __restrict s, size_t maxsize, const char * __restrict format, + const struct tm * __restrict t) { char * p; int warn; diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c index 7f3084bfbc..9b4b01268b 100644 --- a/lib/libc/stdtime/strptime.c +++ b/lib/libc/stdtime/strptime.c @@ -56,7 +56,8 @@ static const u_char *find_string(const u_char *, int *, const char * const *, const char * const *, int); char * -strptime(const char *buf, const char *fmt, struct tm *tm) +strptime(const char * __restrict buf, const char * __restrict fmt, + struct tm * __restrict tm) { unsigned char c; const unsigned char *bp; -- 2.41.0