X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=op.h;h=85cd8340af758a9f60b14af925984e86a6751df4;hb=9e371ce52563b387ab3a179d3e9ef29da90acdf1;hp=e92b1d8db4b99bae7faed270d26150ccdee4f55b;hpb=5f8cb0464db8019389b7bf1816b817fa4d44ca34;p=p5sagit%2Fp5-mst-13.2.git diff --git a/op.h b/op.h index e92b1d8..85cd834 100644 --- a/op.h +++ b/op.h @@ -250,8 +250,8 @@ struct pmop { }; #ifdef USE_ITHREADS -#define PM_GETRE(o) ((REGEXP*)SvIVX(PL_regex_pad[(o)->op_pmoffset])) -#define PM_SETRE(o,r) (sv_setiv(PL_regex_pad[(o)->op_pmoffset], (IV)r)) +#define PM_GETRE(o) (INT2PTR(REGEXP*,SvIVX(PL_regex_pad[(o)->op_pmoffset]))) +#define PM_SETRE(o,r) (sv_setiv(PL_regex_pad[(o)->op_pmoffset], PTR2IV(r))) #define PM_GETRE_SAFE(o) (PL_regex_pad ? PM_GETRE(o) : (REGEXP*)0) #define PM_SETRE_SAFE(o,r) if (PL_regex_pad) PM_SETRE(o,r) #else @@ -461,10 +461,25 @@ struct loop { #define PERL_LOADMOD_IMPORT_OPS 0x4 #ifdef USE_REENTRANT_API + typedef struct { struct tm* tmbuff; } REBUF; -#define localtime(a) localtime_r(a,PL_reentrant_buffer->tmbuff) -#define gmtime(a) gmtime_r(a,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 + +/* HP-UX 10.20 returns 0 on success, what it returns on failure is hidden + in the fog somewhere, possibly -1 which means the following should do + the right thing - 20010816 sky */ + +#undef localtime +#undef gmtime +#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