1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-14 20:01:03 +03:00

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.
This commit is contained in:
Zack Weinberg
2019-08-16 21:10:11 -04:00
parent f9fabc1b02
commit 1baae4aa6f
6 changed files with 17 additions and 6 deletions

View File

@ -30,7 +30,7 @@ strfry (char *string)
{
static char state[32];
rdata.state = NULL;
__initstate_r (time ((time_t *) NULL) ^ getpid (),
__initstate_r (time (NULL) ^ getpid (),
state, sizeof (state), &rdata);
init = 1;
}