[tz] [PROPOSED PATCH] Make the library thread-safe if THREAD_SAFE is defined.

Paul Eggert eggert at cs.ucla.edu
Mon Aug 18 19:22:30 UTC 2014

walter harms wrote:
> i had the impression that the patch was up to discussion

Yes, although the code you're mentioning is unchanged from 2014f, and is 
present in the diff only due to unrelated refactoring, so I'd rather 
install this change as a separate patch.

> it would simply mean that every field is already 0 no need to do this manually,
> saving a few bytes.

That wouldn't work, because in the normal case malloc (or calloc) is not 
called and the storage is reused, so it needs to be initialized anyway.

We could replace the initialization code with a call to memset but on my 
platform (Fedora 20 x86-64 GCC 4.9.1) that made the 'date' executable 
slightly larger and I presume slightly slower.

More information about the tz mailing list