This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Renaming tweaks, and split off the reentrant "superbuffer"
authorJarkko Hietaniemi <jhi@iki.fi>
Sun, 10 Mar 2002 04:57:07 +0000 (04:57 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 10 Mar 2002 04:57:07 +0000 (04:57 +0000)
init routine.

p4raw-id: //depot/perl@15139

embed.fnc
embed.h
global.sym
intrpvar.h
op.h
perl.c
proto.h
sv.c
util.c

index 52472a0..8a684c1 100644 (file)
--- 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 9d66677..7ffb796 100644 (file)
--- a/embed.h
+++ b/embed.h
 #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
 #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)
index 9b709ec..760606c 100644 (file)
@@ -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
index dccbdb6..f113def 100644 (file)
@@ -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 1cbacb3..da59e44 100644 (file)
--- 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 6b8532e..17b43fc 100644 (file)
--- 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 159d968..2c2e93f 100644 (file)
--- 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 799ffab..32ea125 100644 (file)
--- 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 303bfa4..138cb9c 100644 (file)
--- 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
+}
+