summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embed.fnc3
-rw-r--r--embed.h6
-rw-r--r--global.sym1
-rw-r--r--intrpvar.h2
-rw-r--r--op.h12
-rw-r--r--perl.c5
-rw-r--r--proto.h3
-rw-r--r--sv.c3
-rw-r--r--util.c9
9 files changed, 32 insertions, 12 deletions
diff --git a/embed.fnc b/embed.fnc
index 52472a06df..8a684c1857 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -554,6 +554,9 @@ dopM |PerlIO*|start_glob |SV* pattern|IO *io
#if defined(USE_5005THREADS)
Ap |struct perl_thread* |new_struct_thread|struct perl_thread *t
#endif
+#if defined(USE_REENTRANT_API)
+Ap |void |reentrant_init
+#endif
Ap |void |call_atexit |ATEXIT_t fn|void *ptr
Apd |I32 |call_argv |const char* sub_name|I32 flags|char** argv
Apd |I32 |call_method |const char* methname|I32 flags
diff --git a/embed.h b/embed.h
index 9d6667755f..7ffb796571 100644
--- a/embed.h
+++ b/embed.h
@@ -533,6 +533,9 @@
#if defined(USE_5005THREADS)
#define new_struct_thread Perl_new_struct_thread
#endif
+#if defined(USE_REENTRANT_API)
+#define reentrant_init Perl_reentrant_init
+#endif
#define call_atexit Perl_call_atexit
#define call_argv Perl_call_argv
#define call_method Perl_call_method
@@ -2089,6 +2092,9 @@
#if defined(USE_5005THREADS)
#define new_struct_thread(a) Perl_new_struct_thread(aTHX_ a)
#endif
+#if defined(USE_REENTRANT_API)
+#define reentrant_init() Perl_reentrant_init(aTHX)
+#endif
#define call_atexit(a,b) Perl_call_atexit(aTHX_ a,b)
#define call_argv(a,b,c) Perl_call_argv(aTHX_ a,b,c)
#define call_method(a,b) Perl_call_method(aTHX_ a,b)
diff --git a/global.sym b/global.sym
index 9b709ec181..760606c0ae 100644
--- a/global.sym
+++ b/global.sym
@@ -321,6 +321,7 @@ Perl_ninstr
Perl_op_free
Perl_pad_sv
Perl_new_struct_thread
+Perl_reentrant_init
Perl_call_atexit
Perl_call_argv
Perl_call_method
diff --git a/intrpvar.h b/intrpvar.h
index dccbdb65b6..f113def0fe 100644
--- a/intrpvar.h
+++ b/intrpvar.h
@@ -487,7 +487,7 @@ PERLVAR(Iregex_pad, SV**) /* All regex objects */
PERLVAR(Iregex_padav, AV*) /* All regex objects */
#ifdef USE_REENTRANT_API
-PERLVAR(Ireentrant_buffer, REBUF*) /* here we store the _r buffers */
+PERLVAR(Ireentrant_buffer, REENTBUF*) /* here we store the _r buffers */
#endif
#endif
diff --git a/op.h b/op.h
index 1cbacb34e9..da59e441b8 100644
--- a/op.h
+++ b/op.h
@@ -479,11 +479,11 @@ struct loop {
#ifdef USE_REENTRANT_API
typedef struct {
- struct tm* tmbuff;
-} REBUF;
+ struct tm* tmbuf;
+} REENTBUF;
-#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)
+#define localtime(a) (localtime_r((a),PL_reentrant_buffer->tmbuf) ? PL_reentrant_buffer->tmbuf : NULL)
+#define gmtime(a) (gmtime_r((a),PL_reentrant_buffer->tmbuf) ? PL_reentrant_buffer->tmbuf : NULL)
#ifdef OLD_PTHREADS_API
@@ -493,8 +493,8 @@ typedef struct {
#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)
+#define localtime(a) ((localtime_r((a),PL_reentrant_buffer->tmbuf) == 0) ? PL_reentrant_buffer->tmbuf : NULL)
+#define gmtime(a) ((gmtime_r((a),PL_reentrant_buffer->tmbuf) == 0) ? PL_reentrant_buffer->tmbuf : NULL)
#endif /* HP-UX 10.20 */
#endif
diff --git a/perl.c b/perl.c
index 6b8532e93d..17b43fc2a6 100644
--- a/perl.c
+++ b/perl.c
@@ -264,8 +264,7 @@ perl_construct(pTHXx)
PL_regex_pad = AvARRAY(PL_regex_padav);
#endif
#ifdef USE_REENTRANT_API
- New(31337, PL_reentrant_buffer,1, REBUF);
- New(31337, PL_reentrant_buffer->tmbuff,1, struct tm);
+ Perl_reentrant_init(aTHX);
#endif
/* Note that strtab is a rather special HV. Assumptions are made
@@ -836,7 +835,7 @@ perl_destruct(pTHXx)
#endif /* USE_5005THREADS */
#ifdef USE_REENTRANT_API
- Safefree(PL_reentrant_buffer->tmbuff);
+ Safefree(PL_reentrant_buffer->tmbuf);
Safefree(PL_reentrant_buffer);
#endif
diff --git a/proto.h b/proto.h
index 159d9687c4..2c2e93fdcd 100644
--- a/proto.h
+++ b/proto.h
@@ -595,6 +595,9 @@ PERL_CALLCONV PerlIO* Perl_start_glob(pTHX_ SV* pattern, IO *io);
#if defined(USE_5005THREADS)
PERL_CALLCONV struct perl_thread* Perl_new_struct_thread(pTHX_ struct perl_thread *t);
#endif
+#if defined(USE_REENTRANT_API)
+PERL_CALLCONV void Perl_reentrant_init(pTHX);
+#endif
PERL_CALLCONV void Perl_call_atexit(pTHX_ ATEXIT_t fn, void *ptr);
PERL_CALLCONV I32 Perl_call_argv(pTHX_ const char* sub_name, I32 flags, char** argv);
PERL_CALLCONV I32 Perl_call_method(pTHX_ const char* methname, I32 flags);
diff --git a/sv.c b/sv.c
index 799ffab5a3..32ea125494 100644
--- a/sv.c
+++ b/sv.c
@@ -9867,8 +9867,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
PL_debug = proto_perl->Idebug;
#ifdef USE_REENTRANT_API
- New(31337, PL_reentrant_buffer,1, REBUF);
- New(31337, PL_reentrant_buffer->tmbuff,1, struct tm);
+ Perl_reentrant_init(aTHX);
#endif
/* create SV map for pointer relocation */
diff --git a/util.c b/util.c
index 303bfa449f..138cb9cd57 100644
--- a/util.c
+++ b/util.c
@@ -4348,5 +4348,14 @@ Perl_sv_nounlocking(pTHX_ SV *sv)
{
}
+void
+Perl_reentrant_init(pTHX)
+{
+#ifdef USE_REENTRANT_API
+ New(31337, PL_reentrant_buffer, 1, REENTBUF);
+ New(31337, PL_reentrant_buffer->tmbuf, 1, struct tm);
+#endif
+}
+