This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove some repeated code in pp_regcomp
authorFather Chrysostomos <sprout@cpan.org>
Sat, 29 Oct 2011 20:41:13 +0000 (13:41 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 29 Oct 2011 20:42:07 +0000 (13:42 -0700)
pp_ctl.c

index eb74840..6405924 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -214,19 +214,11 @@ PP(pp_regcomp)
                const char *const p = SvPV(tmpstr, len);
                tmpstr = newSVpvn_flags(p, len, SVs_TEMP);
            }
-           else if (SvAMAGIC(tmpstr)) {
+           else if (SvAMAGIC(tmpstr) || SvGMAGICAL(tmpstr)) {
                /* make a copy to avoid extra stringifies */
                tmpstr = newSVpvn_flags(t, len, SVs_TEMP | SvUTF8(tmpstr));
            }
 
-           /* If it is gmagical, create a mortal copy, but without calling
-              get-magic, as we have already done that. */
-           if(SvGMAGICAL(tmpstr)) {
-               SV *mortalcopy = sv_newmortal();
-               sv_setsv_flags(mortalcopy, tmpstr, 0);
-               tmpstr = mortalcopy;
-           }
-
            if (eng)
                PM_SETRE(pm, CALLREGCOMP_ENG(eng, tmpstr, pm_flags));
            else