From 1baae4aa6f3313da77d799f12f963910b05db637 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Fri, 16 Aug 2019 21:10:11 -0400 Subject: Don't use the argument to time. It doesn't make sense to remove all the internal uses of time. It's still a standard ISO C function, and its callers don't need sub-second resolution and would be unnecessarily complicated if they had to declare a struct timespec instead of just a time_t. However, a handful of places were using the vestigial "result" argument instead of the return value, which is slightly less efficient and also looks strange. Correct this. * misc/syslog.c (__vsyslog_internal) * time/getdate.c (__getdate_r) * time/tst_wcsftime.c (main): Use return value of time, not its argument. * string/strfry.c (strfry) * sysdeps/mach/sleep.c (__sleep): Remove unnecessary casts of NULL in calls to time. --- time/getdate.c | 2 +- time/tst_wcsftime.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'time') diff --git a/time/getdate.c b/time/getdate.c index aee96f7..8a567c3 100644 --- a/time/getdate.c +++ b/time/getdate.c @@ -219,7 +219,7 @@ __getdate_r (const char *string, struct tm *tp) return 7; /* Get current time. */ - time (&timer); + timer = time (NULL); __localtime_r (&timer, &tm); /* If only the weekday is given, today is assumed if the given day diff --git a/time/tst_wcsftime.c b/time/tst_wcsftime.c index 3f6f0d9..55c45f6 100644 --- a/time/tst_wcsftime.c +++ b/time/tst_wcsftime.c @@ -10,7 +10,7 @@ main (int argc, char *argv[]) int result = 0; size_t n; - time (&t); + t = time (NULL); tp = gmtime (&t); n = wcsftime (buf, sizeof (buf) / sizeof (buf[0]), -- cgit v1.1