Change 32032 by [EMAIL PROTECTED] on 2007/10/05 16:08:12

        As PL_hinthv is actually tied, need to call SvSETMAGIC() after the
        store to it. Gosh, the tied hash API is clunky.

Affected files ...

... //depot/perl/mg.c#506 edit
... //depot/perl/pp_ctl.c#631 edit

Differences ...

==== //depot/perl/mg.c#506 (text) ====
Index: perl/mg.c
--- perl/mg.c#505~32027~        2007-10-04 08:06:59.000000000 -0700
+++ perl/mg.c   2007-10-05 09:08:12.000000000 -0700
@@ -3008,7 +3008,8 @@
 Perl_magic_sethint(pTHX_ SV *sv, MAGIC *mg)
 {
     dVAR;
-    assert(mg->mg_len == HEf_SVKEY);
+    SV *key = (mg->mg_len == HEf_SVKEY) ? (SV *)mg->mg_ptr
+       : sv_2mortal(newSVpvn(mg->mg_ptr, mg->mg_len));
 
     /* mg->mg_obj isn't being used.  If needed, it would be possible to store
        an alternative leaf in there, with PL_compiling.cop_hints being used if
@@ -3020,8 +3021,7 @@
        forgetting to do it, and consequent subtle errors.  */
     PL_hints |= HINT_LOCALIZE_HH;
     PL_compiling.cop_hints_hash
-       = Perl_refcounted_he_new(aTHX_ PL_compiling.cop_hints_hash,
-                                (SV *)mg->mg_ptr, sv);
+       = Perl_refcounted_he_new(aTHX_ PL_compiling.cop_hints_hash, key, sv);
     return 0;
 }
 

==== //depot/perl/pp_ctl.c#631 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#630~32031~    2007-10-05 04:45:25.000000000 -0700
+++ perl/pp_ctl.c       2007-10-05 09:08:12.000000000 -0700
@@ -3144,8 +3144,11 @@
            vcmp(sv, sv_2mortal(upg_version(newSVnv(5.006), FALSE))) >= 0) {
          HV * hinthv = GvHV(PL_hintgv);
          if( hinthv ) {
-           (void)hv_stores(hinthv, "v_string", newSViv(1));
-           PL_hints |= HINT_LOCALIZE_HH;
+             SV *hint = newSViv(1);
+             (void)hv_stores(hinthv, "v_string", hint);
+             /* This will call through to Perl_magic_sethint() which in turn
+                sets PL_hints correctly.  */
+             SvSETMAGIC(hint);
          }
          /* If we request a version >= 5.9.5, load feature.pm with the
           * feature bundle that corresponds to the required version. */
End of Patch.

Reply via email to