Proposed asctime-related changes

Clive D.W. Feather clive at demon.net
Mon Aug 9 20:46:00 UTC 2004


Olson, Arthur David (NIH/NCI) said:
> However, zdump.c might be compiled with a version of localtime or gmtime
> that does something evil, so defensive programming may be in order.

True.

> Casts along the lines shown below should do the trick.
> 
> 				--ado
> 
> 	if (timeptr->tm_wday < 0 ||
> 		timeptr->tm_wday >= (int) (sizeof wday_name / sizeof
> wday_name[0]))

    if ((unsigned) timeptr->tm_wday >= sizeof wday_name / sizeof wday_name[0])

makes it one comparison instead of two.

-- 
Clive D.W. Feather  | Work:  <clive at demon.net>   | Tel:    +44 20 8495 6138
Internet Expert     | Home:  <clive at davros.org>  | Fax:    +44 870 051 9937
Demon Internet      | WWW: http://www.davros.org | Mobile: +44 7973 377646
Thus plc            |                            |



More information about the tz mailing list