This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PL_amagic_generation doesn't show overload loaded
authorDavid Mitchell <davem@iabyn.com>
Sat, 3 Jul 2010 12:36:59 +0000 (13:36 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sat, 3 Jul 2010 15:25:58 +0000 (16:25 +0100)
PL_amagic_generation is non-zero even without the presence of
'use overload', so don't bother using it as a short-cut test of
whether we can skip AMAGIC processing

pp_ctl.c
pp_sort.c

index 1aca2a0..ccda760 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -117,17 +117,15 @@ PP(pp_regcomp)
        sv_setpvs(tmpstr, "");
        while (++MARK <= SP) {
            SV *msv = *MARK;
-           if (PL_amagic_generation) {
-               SV *sv;
+           SV *sv;
 
-               tryAMAGICregexp(msv);
+           tryAMAGICregexp(msv);
 
-               if ((SvAMAGIC(tmpstr) || SvAMAGIC(msv)) &&
-                   (sv = amagic_call(tmpstr, msv, concat_amg, AMGf_assign)))
-               {
-                  sv_setsv(tmpstr, sv);
-                  continue;
-               }
+           if ((SvAMAGIC(tmpstr) || SvAMAGIC(msv)) &&
+               (sv = amagic_call(tmpstr, msv, concat_amg, AMGf_assign)))
+           {
+              sv_setsv(tmpstr, sv);
+              continue;
            }
            sv_catsv(tmpstr, msv);
        }
index ed9c809..f1ec82a 100644 (file)
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1858,7 +1858,7 @@ S_sv_i_ncmp(pTHX_ SV *const a, SV *const b)
 }
 
 #define tryCALL_AMAGICbin(left,right,meth) \
-    (PL_amagic_generation && (SvAMAGIC(left)||SvAMAGIC(right))) \
+    (SvAMAGIC(left)||SvAMAGIC(right)) \
        ? amagic_call(left, right, CAT2(meth,_amg), 0) \
        : NULL;