httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <>
Subject Re: Thread safe functions in APR.
Date Wed, 06 Oct 1999 15:57:51 GMT

> > >#ifdef HAVE_GMTIME_R
> > >#define GMTIME_R(x, y) gmtime_r(x, y)
> > >#else
> > >#define GMTIME_R(x, y) memcpy(y, gmtime(x), sizeof(y))
> > >#endif
> > 
> > We can't use sizeof(y) unless we know that y is a struct and not a pointer,
> > which is not the case in the patch committed.  It is safer to define an
> > ap_gmtime with a single interface, and just change the implementation based
> > on whether gmtime_r is available.

I was wrong when I replied to you last night.  We can't use sizeof(y), but
we can use sizeof(struct tm).  This is a VERY specific case that we are
defining with this macro.  If the user supplies something other than the
type we are expecting, it will die anyway.  And this keeps us from having
to make an extra function call.


Ryan Bloom
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	

View raw message