This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fixed macros for localtime_r under USE_REENTRANT_API, also fixed for HP-UX 10.20
authorArtur Bergman <sky@nanisky.com>
Fri, 17 Aug 2001 07:11:24 +0000 (07:11 +0000)
committerArtur Bergman <sky@nanisky.com>
Fri, 17 Aug 2001 07:11:24 +0000 (07:11 +0000)
Thanks to Tom Hospel for pointing out my error.

p4raw-id: //depot/perl@11703

op.h

diff --git a/op.h b/op.h
index 0b4d555..dbfaced 100644 (file)
--- a/op.h
+++ b/op.h
@@ -465,8 +465,8 @@ typedef struct {
   struct tm* tmbuff;
 } REBUF;
 
-#define localtime(a)       (localtime_r(a,PL_reentrant_buffer->tmbuff && PL_reentrant_buffer->tmbuff)
-#define gmtime(a)          (gmtime_r(a,PL_reentrant_buffer->tmbuff && PL_reentrant_buffer->tmbuff)
+#define localtime(a)       (localtime_r((a),PL_reentrant_buffer->tmbuff) ? PL_reentrant_buffer->tmbuff : NULL)
+#define gmtime(a)          (gmtime_r((a),PL_reentrant_buffer->tmbuff) ?  PL_reentrant_buffer->tmbuff : NULL)
 
 #if defined(__hpux) && defined(__ux_version) && __ux_version <= 1020
 
@@ -476,8 +476,8 @@ typedef struct {
 
 #undef localtime
 #undef gmtime
-#define localtime(a)       ((localtime_r(a,PL_reentrant_buffer->tmbuff)+1) && PL_reentrant_buffer->tmbuff)
-#define gmtime(a)          ((gmtime_r(a,PL_reentrant_buffer->tmbuff)+1) && PL_reentrant_buffer->tmbuff)
+#define localtime(a)       ((localtime_r((a),PL_reentrant_buffer->tmbuff) == 0) ? PL_reentrant_buffer->tmbuff : NULL)
+#define gmtime(a)          ((gmtime_r((a),PL_reentrant_buffer->tmbuff) == 0) ? PL_reentrant_buffer->tmbuff : NULL)
 #endif /* HP-UX 10.20 */
 
 #endif