On Sat, May 25, 2013 at 10:29:55AM -0500, Jim Ursetto wrote:
> 
> On May 25, 2013, at 4:46 AM, Peter Bex <peter....@xs4all.nl> wrote:
> 
> > There are also some memsets still left in the code after your patch,
> > so some get initialized using C_tm_init, and some using memset.
> 
> Only strptime gets initialized with C_tm_init, and the rest with memset.  
> strptime produces a time vector (C_tm_get), while the others deconstruct one 
> (C_tm_set).  So these initializations are for two different purposes, i.e.:
> 
> The memset zeroes out the struct before we copy *all* fields in from a Scheme 
> vector (in case there are hidden fields).  The C_tm_init zeroes out the 
> struct and sets a few sane default values.  It is only strptime that needs 
> this extra initialization, as it's the only call for which we may have only 
> partial information.  This is basically equivalent to creating a Scheme 
> vector with sane default values and copying it in using C_tm_set(), like the 
> others do, just implemented in C without needing a fresh default time vector.
> 
> Just want to make sure you are aware of this.  I assumed the existing code 
> uses a static buffer for efficiency to minimize garbage.

Yeah, I figured the same.  I doubt it's going to make much of a
difference in most cases.

What do the other -hackers think of this?

Cheers,
Peter
-- 
http://www.more-magic.net

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to