[tz] localtime.c patch
Christos Zoulas
christos at zoulas.com
Tue Oct 7 21:14:32 UTC 2014
On Oct 7, 4:48pm, arthurdavidolson at gmail.com (Arthur David Olson) wrote:
-- Subject: Re: [tz] localtime.c patch
| Back in the 1980s (when this code had its origins), NULL pointers weren't
| guaranteed to be all zeroes; having a static, otherwise unused structure
| (which was guaranteed to be initialized correctly) for initialization
| purposes was cheap portability insurance. (The insurance was taken out
| consistently, both for uniformity and to avoid problems if a pointer was
| added to a structure later.) Given updates to the C standard and waning
| interest in supporting old systems, this insurance may well no longer be
| needed.
I don't think that there are any systems where this code will compile that
have this limitation. Strictly speaking you are right of course.
| Meanwhile, changing...
| memset(sp->ttis, 0, sizeof(sp->ttis));
| ...to...
| memset(sp->ttis, 0, sizeof sp->ttis);
| ...saves a character and is a reminder (to me, at least) that sizeof isn't
| a function.
There is a bug fix there too; in one of the cases sp->ttis[1]
is not initialized, and returns trash to the user.
christos
More information about the tz
mailing list