<div dir="ltr"><div>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.<br></div><div><br></div><div>Meanwhile, changing...<br></div><div> memset(sp->ttis, 0, sizeof(sp->ttis));<br></div><div>...to...<br></div><div> memset(sp->ttis, 0, sizeof sp->ttis);<br></div><div>...saves a character and is a reminder (to me, at least) that sizeof isn't a function.<br><br></div><div> @dashdashado<br></div><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 7, 2014 at 4:25 PM, Christos Zoulas <span dir="ltr"><<a href="mailto:christos@zoulas.com" target="_blank">christos@zoulas.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Minor nits.<br>
<br>
christos<br>
<br>
--- localtime.c.orig 2014-10-07 16:20:32.000000000 -0400<br>
+++ localtime.c 2014-10-07 16:22:47.000000000 -0400<br>
@@ -306,3 +306,3 @@<br>
register int stored;<br>
- register int nread;<br>
+ register ssize_t nread;<br>
typedef union {<br>
@@ -934,3 +934,2 @@<br>
register bool load_ok;<br>
- static struct ttinfo zttinfo;<br>
<br>
@@ -1006,3 +1005,3 @@<br>
*/<br>
- sp->ttis[0] = sp->ttis[1] = zttinfo;<br>
+ memset(sp->ttis, 0, sizeof(sp->ttis));<br>
sp->ttis[0].tt_gmtoff = -dstoffset;<br>
@@ -1131,3 +1130,3 @@<br>
*/<br>
- sp->ttis[0] = sp->ttis[1] = zttinfo;<br>
+ memset(sp->ttis, 0, sizeof(sp->ttis));<br>
sp->ttis[0].tt_gmtoff = -stdoffset;<br>
@@ -1145,3 +1144,3 @@<br>
sp->timecnt = 0;<br>
- sp->ttis[0] = zttinfo;<br>
+ memset(sp->ttis, 0, sizeof(sp->ttis));<br>
sp->ttis[0].tt_gmtoff = -stdoffset;<br>
@@ -2108,3 +2107,2 @@<br>
<br>
- sp = lclptr;<br>
i = sp->leapcnt;<br>
</blockquote></div><br></div>