Change 31766 by [EMAIL PROTECTED] on 2007/08/30 14:01:25

        Subject: [PATCH-revised] [perl #44999] ExtUtils::Constant::ProxySubs 
not thread-safe
        From: "Jerry D. Hedden" <[EMAIL PROTECTED]>
        Date: Thu, 30 Aug 2007 09:37:59 -0400
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/lib/ExtUtils/Constant/ProxySubs.pm#18 edit

Differences ...

==== //depot/perl/lib/ExtUtils/Constant/ProxySubs.pm#18 (text) ====
Index: perl/lib/ExtUtils/Constant/ProxySubs.pm
--- perl/lib/ExtUtils/Constant/ProxySubs.pm#17~29650~   2007-01-01 
07:41:48.000000000 -0800
+++ perl/lib/ExtUtils/Constant/ProxySubs.pm     2007-08-30 07:01:25.000000000 
-0700
@@ -9,7 +9,7 @@
 use ExtUtils::Constant::Utils qw(C_stringify);
 use ExtUtils::Constant::XS qw(%XS_TypeSet);
 
-$VERSION = '0.03';
+$VERSION = '0.04';
 @ISA = 'ExtUtils::Constant::XS';
 
 %type_to_struct =
@@ -218,7 +218,7 @@
 
 EOADD
 
-    print $c_fh $explosives ? <<"EXPLODE" : <<"DONT";
+    print $c_fh $explosives ? <<"EXPLODE" : "\n";
 
 static int
 Im_sorry_Dave(pTHX_ SV *sv, MAGIC *mg)
@@ -242,12 +242,6 @@
 
 EXPLODE
 
-#ifndef SYMBIAN
-static HV *${c_subname}_missing = NULL;
-#endif
-
-DONT
-
     print $xs_fh <<"EOBOOT";
 BOOT:
   {
@@ -255,6 +249,18 @@
     dTHX;
 #endif
     HV *symbol_table = get_hv("$symbol_table", TRUE);
+#ifndef SYMBIAN
+    /* When we create the 'missing' hash, it generates a 'used only once'
+     * warning.  Therefore, turn off warnings while we do this.
+     */
+    HV *${c_subname}_missing;
+    {
+        const bool warn_tmp = PL_dowarn;
+        PL_dowarn = 0;
+        ${c_subname}_missing = get_hv("${symbol_table}${c_subname}_M!55!NG", 
TRUE);
+        PL_dowarn = warn_tmp;
+    }
+#endif
 EOBOOT
 
     my %iterator;
@@ -320,11 +326,6 @@
                                              'symbol_table',
                                              $add_symbol_subname);
     }
-    print $xs_fh $explosives ? "\n" : <<"EOBOOT";
-#ifndef SYMBIAN
-       ${c_subname}_missing = newHV();
-#endif
-EOBOOT
 
     print $xs_fh <<"EOBOOT";
        while (value_for_notfound->name) {
@@ -464,6 +465,7 @@
 #ifdef SYMBIAN
        sv = newSVpvf("%"SVf" is not a valid $package_sprintf_safe macro", sv);
 #else
+       HV *${c_subname}_missing = get_hv("${c_subname}_M!55!NG", FALSE);
        if (hv_exists(${c_subname}_missing, s, SvUTF8(sv) ? -(I32)len : 
(I32)len)) {
            sv = newSVpvf("Your vendor has not defined $package_sprintf_safe 
macro %" SVf
                          ", used", sv);
End of Patch.

Reply via email to