Change 11283 by jhi@alpha on 2001/07/12 00:52:36

        Subject: [PATCH] Use reentrant API glibc
        From: Artur Bergman <[EMAIL PROTECTED]>
        Date: Thu, 12 Jul 2001 00:58:21 +0200
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/embedvar.h#115 edit
... //depot/perl/intrpvar.h#80 edit
... //depot/perl/op.h#83 edit
... //depot/perl/perl.c#345 edit
... //depot/perl/perlapi.h#38 edit
... //depot/perl/pod/perlapi.pod#88 edit
... //depot/perl/sv.c#437 edit

Differences ...

==== //depot/perl/embedvar.h#115 (text+w) ====
Index: perl/embedvar.h
--- perl/embedvar.h.~1~ Wed Jul 11 19:00:05 2001
+++ perl/embedvar.h     Wed Jul 11 19:00:05 2001
@@ -360,6 +360,7 @@
 #define PL_psig_pend           (PERL_GET_INTERP->Ipsig_pend)
 #define PL_psig_ptr            (PERL_GET_INTERP->Ipsig_ptr)
 #define PL_ptr_table           (PERL_GET_INTERP->Iptr_table)
+#define PL_reentrant_buffer    (PERL_GET_INTERP->Ireentrant_buffer)
 #define PL_regex_pad           (PERL_GET_INTERP->Iregex_pad)
 #define PL_regex_padav         (PERL_GET_INTERP->Iregex_padav)
 #define PL_replgv              (PERL_GET_INTERP->Ireplgv)
@@ -644,6 +645,7 @@
 #define PL_psig_pend           (vTHX->Ipsig_pend)
 #define PL_psig_ptr            (vTHX->Ipsig_ptr)
 #define PL_ptr_table           (vTHX->Iptr_table)
+#define PL_reentrant_buffer    (vTHX->Ireentrant_buffer)
 #define PL_regex_pad           (vTHX->Iregex_pad)
 #define PL_regex_padav         (vTHX->Iregex_padav)
 #define PL_replgv              (vTHX->Ireplgv)
@@ -1065,6 +1067,7 @@
 #define PL_psig_pend           (aTHXo->interp.Ipsig_pend)
 #define PL_psig_ptr            (aTHXo->interp.Ipsig_ptr)
 #define PL_ptr_table           (aTHXo->interp.Iptr_table)
+#define PL_reentrant_buffer    (aTHXo->interp.Ireentrant_buffer)
 #define PL_regex_pad           (aTHXo->interp.Iregex_pad)
 #define PL_regex_padav         (aTHXo->interp.Iregex_padav)
 #define PL_replgv              (aTHXo->interp.Ireplgv)
@@ -1350,6 +1353,7 @@
 #define PL_Ipsig_pend          PL_psig_pend
 #define PL_Ipsig_ptr           PL_psig_ptr
 #define PL_Iptr_table          PL_ptr_table
+#define PL_Ireentrant_buffer   PL_reentrant_buffer
 #define PL_Iregex_pad          PL_regex_pad
 #define PL_Iregex_padav                PL_regex_padav
 #define PL_Ireplgv             PL_replgv

==== //depot/perl/intrpvar.h#80 (text) ====
Index: perl/intrpvar.h
--- perl/intrpvar.h.~1~ Wed Jul 11 19:00:05 2001
+++ perl/intrpvar.h     Wed Jul 11 19:00:05 2001
@@ -478,6 +478,8 @@
 #if defined(USE_ITHREADS)
 PERLVAR(Iregex_pad,     SV**)    /* All regex objects */
 PERLVAR(Iregex_padav,   AV*)    /* All regex objects */
+
+PERLVAR(Ireentrant_buffer, REBUF*) /* were we store _r buffers */
 #endif
 
 /* New variables must be added to the very end for binary compatibility.

==== //depot/perl/op.h#83 (text) ====
Index: perl/op.h
--- perl/op.h.~1~       Wed Jul 11 19:00:05 2001
+++ perl/op.h   Wed Jul 11 19:00:05 2001
@@ -456,3 +456,12 @@
 #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)
+#define gmtime(a)          gmtime_r(a,PL_reentrant_buffer->tmbuff)
+#endif
+

==== //depot/perl/perl.c#345 (text) ====
Index: perl/perl.c
--- perl/perl.c.~1~     Wed Jul 11 19:00:05 2001
+++ perl/perl.c Wed Jul 11 19:00:05 2001
@@ -309,6 +309,10 @@
 #ifdef USE_ITHREADS
         PL_regex_padav = newAV();
 #endif
+#ifdef USE_REENTRANT_API
+    New(31337, PL_reentrant_buffer,1, REBUF);
+    New(31337, PL_reentrant_buffer->tmbuff,1, struct tm);
+#endif
     ENTER;
 }
 
@@ -801,6 +805,11 @@
     PL_thrsv = Nullsv;
 #endif /* USE_THREADS */
 
+#ifdef USE_REENTRANT_API
+    Safefree(PL_reentrant_buffer->tmbuff);
+    Safefree(PL_reentrant_buffer);
+#endif
+
     sv_free_arenas();
 
     /* As the absolutely last thing, free the non-arena SV for mess() */

==== //depot/perl/perlapi.h#38 (text+w) ====
Index: perl/perlapi.h
--- perl/perlapi.h.~1~  Wed Jul 11 19:00:05 2001
+++ perl/perlapi.h      Wed Jul 11 19:00:05 2001
@@ -458,6 +458,8 @@
 #define PL_psig_ptr            (*Perl_Ipsig_ptr_ptr(aTHXo))
 #undef  PL_ptr_table
 #define PL_ptr_table           (*Perl_Iptr_table_ptr(aTHXo))
+#undef  PL_reentrant_buffer
+#define PL_reentrant_buffer    (*Perl_Ireentrant_buffer_ptr(aTHXo))
 #undef  PL_regex_pad
 #define PL_regex_pad           (*Perl_Iregex_pad_ptr(aTHXo))
 #undef  PL_regex_padav

==== //depot/perl/pod/perlapi.pod#88 (text+w) ====
Index: perl/pod/perlapi.pod
--- perl/pod/perlapi.pod.~1~    Wed Jul 11 19:00:05 2001
+++ perl/pod/perlapi.pod        Wed Jul 11 19:00:05 2001
@@ -1344,17 +1344,6 @@
 =for hackers
 Found in file sv.c
 
-=item newSV
-
-Create a new null SV, or if len > 0, create a new empty SVt_PV type SV
-with an initial PV allocation of len+1. Normally accessed via the C<NEWSV>
-macro.
-
-       SV*     newSV(STRLEN len)
-
-=for hackers
-Found in file sv.c
-
 =item NEWSV
 
 Creates a new SV.  A non-zero C<len> parameter indicates the number of
@@ -1368,6 +1357,17 @@
 =for hackers
 Found in file handy.h
 
+=item newSV
+
+Create a new null SV, or if len > 0, create a new empty SVt_PV type SV
+with an initial PV allocation of len+1. Normally accessed via the C<NEWSV>
+macro.
+
+       SV*     newSV(STRLEN len)
+
+=for hackers
+Found in file sv.c
+
 =item newSViv
 
 Creates a new SV and copies an integer into it.  The reference count for the
@@ -2119,22 +2119,22 @@
 =for hackers
 Found in file sv.h
 
-=item SvIVX
+=item SvIVx
 
-Returns the raw value in the SV's IV slot, without checks or conversions.
-Only use when you are sure SvIOK is true. See also C<SvIV()>.
+Coerces the given SV to an integer and returns it. Guarantees to evaluate
+sv only once. Use the more efficent C<SvIV> otherwise.
 
-       IV      SvIVX(SV* sv)
+       IV      SvIVx(SV* sv)
 
 =for hackers
 Found in file sv.h
 
-=item SvIVx
+=item SvIVX
 
-Coerces the given SV to an integer and returns it. Guarantees to evaluate
-sv only once. Use the more efficent C<SvIV> otherwise.
+Returns the raw value in the SV's IV slot, without checks or conversions.
+Only use when you are sure SvIOK is true. See also C<SvIV()>.
 
-       IV      SvIVx(SV* sv)
+       IV      SvIVX(SV* sv)
 
 =for hackers
 Found in file sv.h
@@ -2443,21 +2443,21 @@
 =for hackers
 Found in file sv.h
 
-=item SvPVX
+=item SvPVx
 
-Returns a pointer to the physical string in the SV.  The SV must contain a
-string.
+A version of C<SvPV> which guarantees to evaluate sv only once.
 
-       char*   SvPVX(SV* sv)
+       char*   SvPVx(SV* sv, STRLEN len)
 
 =for hackers
 Found in file sv.h
 
-=item SvPVx
+=item SvPVX
 
-A version of C<SvPV> which guarantees to evaluate sv only once.
+Returns a pointer to the physical string in the SV.  The SV must contain a
+string.
 
-       char*   SvPVx(SV* sv, STRLEN len)
+       char*   SvPVX(SV* sv)
 
 =for hackers
 Found in file sv.h
@@ -2664,19 +2664,19 @@
 =for hackers
 Found in file sv.h
 
-=item svtype
+=item SvTYPE
+
+Returns the type of the SV.  See C<svtype>.
 
-An enum of flags for Perl types.  These are found in the file B<sv.h> 
-in the C<svtype> enum.  Test these flags with the C<SvTYPE> macro.
+       svtype  SvTYPE(SV* sv)
 
 =for hackers
 Found in file sv.h
 
-=item SvTYPE
+=item svtype
 
-Returns the type of the SV.  See C<svtype>.
-
-       svtype  SvTYPE(SV* sv)
+An enum of flags for Perl types.  These are found in the file B<sv.h> 
+in the C<svtype> enum.  Test these flags with the C<SvTYPE> macro.
 
 =for hackers
 Found in file sv.h

==== //depot/perl/sv.c#437 (text) ====
Index: perl/sv.c
--- perl/sv.c.~1~       Wed Jul 11 19:00:05 2001
+++ perl/sv.c   Wed Jul 11 19:00:05 2001
@@ -9589,6 +9589,11 @@
 
     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);
+#endif
+
     /* create SV map for pointer relocation */
     PL_ptr_table = ptr_table_new();
 
End of Patch.

Reply via email to