X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=op.h;h=85cd8340af758a9f60b14af925984e86a6751df4;hb=9e371ce52563b387ab3a179d3e9ef29da90acdf1;hp=33afa0a5282068896fddea5e273a4f7a109a6965;hpb=fd1bc7ebd07df539346875ee9afb9361449a1176;p=p5sagit%2Fp5-mst-13.2.git diff --git a/op.h b/op.h index 33afa0a..85cd834 100644 --- a/op.h +++ b/op.h @@ -166,7 +166,6 @@ Deprecated. Use C instead. #define OPpTARGET_MY 16 /* Target is PADMY. */ /* Private for OP_CONST */ -#define OPpCONST_OCTAL 4 /* Octal constant. */ #define OPpCONST_STRICT 8 /* bearword subject to strict 'subs' */ #define OPpCONST_ENTERED 16 /* Has been entered as symbol. */ #define OPpCONST_ARYBASE 32 /* Was a $[ translated to constant. */ @@ -251,11 +250,15 @@ struct pmop { }; #ifdef USE_ITHREADS -#define PM_GETRE(o) ((REGEXP*)SvIV(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 #define PM_GETRE(o) ((o)->op_pmregexp) #define PM_SETRE(o,r) ((o)->op_pmregexp = (r)) +#define PM_GETRE_SAFE PM_GETRE +#define PM_SETRE_SAFE PM_SETRE #endif #define PMdf_USED 0x01 /* pm has been used once already */ @@ -456,3 +459,27 @@ struct loop { #define PERL_LOADMOD_DENY 0x1 #define PERL_LOADMOD_NOIMPORT 0x2 #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) ? 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 +