diff options
author | Karl Williamson <khw@cpan.org> | 2020-03-15 14:18:53 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-03-18 18:05:49 -0600 |
commit | e63f5cd52c6c3c1a6bfd3378cba9f99dea62b3b2 (patch) | |
tree | 92011858fd7fa23de8e42e98d71c97c7e4542830 /reentr.h | |
parent | 7dc0f1bb7f6dd199fb0aae6f5edfa264e67a051a (diff) | |
download | perl-e63f5cd52c6c3c1a6bfd3378cba9f99dea62b3b2.tar.gz |
reentr.[ch]: Add gmtime_r, localtime_r
This now replaces occurrences of the non re-entrant versions of these
two functions with the reentrant ones.
Diffstat (limited to 'reentr.h')
-rw-r--r-- | reentr.h | 47 |
1 files changed, 41 insertions, 6 deletions
@@ -190,12 +190,13 @@ # define REENTRANT_PROTO_S_SBIE 64 # define REENTRANT_PROTO_S_SBW 65 # define REENTRANT_PROTO_S_TISBI 66 -# define REENTRANT_PROTO_S_TSBI 67 -# define REENTRANT_PROTO_S_TSBIE 68 -# define REENTRANT_PROTO_S_TWISBIE 69 -# define REENTRANT_PROTO_V_D 70 -# define REENTRANT_PROTO_V_H 71 -# define REENTRANT_PROTO_V_ID 72 +# define REENTRANT_PROTO_S_TS 67 +# define REENTRANT_PROTO_S_TSBI 68 +# define REENTRANT_PROTO_S_TSBIE 69 +# define REENTRANT_PROTO_S_TWISBIE 70 +# define REENTRANT_PROTO_V_D 71 +# define REENTRANT_PROTO_V_H 72 +# define REENTRANT_PROTO_V_ID 73 /* Defines for indicating which special features are supported. */ @@ -768,6 +769,14 @@ typedef struct { # endif # endif /* HAS_GETSPNAM_R */ +# ifdef HAS_GMTIME_R + struct tm _gmtime_struct; +# endif /* HAS_GMTIME_R */ + +# ifdef HAS_LOCALTIME_R + struct tm _localtime_struct; +# endif /* HAS_LOCALTIME_R */ + # ifdef HAS_READDIR_R struct dirent* _readdir_struct; size_t _readdir_size; @@ -1453,6 +1462,32 @@ typedef struct { # endif /* HAS_GETSPNAM_R */ +# ifdef HAS_GMTIME_R +# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) +# undef gmtime +# if !defined(gmtime) && GMTIME_R_PROTO == REENTRANT_PROTO_S_TS +# define gmtime(a) (gmtime_r(a, &PL_reentrant_buffer->_gmtime_struct) ? &PL_reentrant_buffer->_gmtime_struct : 0) +# endif +# if defined(gmtime) +# define PERL_REENTR_USING_GMTIME_R +# endif +# endif +# endif /* HAS_GMTIME_R */ + + +# ifdef HAS_LOCALTIME_R +# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) +# undef localtime +# if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_S_TS +# define localtime(a) (L_R_TZSET localtime_r(a, &PL_reentrant_buffer->_localtime_struct) ? &PL_reentrant_buffer->_localtime_struct : 0) +# endif +# if defined(localtime) +# define PERL_REENTR_USING_LOCALTIME_R +# endif +# endif +# endif /* HAS_LOCALTIME_R */ + + # ifdef HAS_READDIR_R # if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) # undef readdir |