summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-09-24 20:33:42 -0700
committerFather Chrysostomos <sprout@cpan.org>2010-09-24 20:33:42 -0700
commita9984b10c8213b2dc4345882bd808798485d584c (patch)
treed2d62b177e106bcd4f6d8e6e1b82a54a5c6bec7a /pp_ctl.c
parent06c841cf64c10f912e4cb0d12dbfc0add671bb81 (diff)
downloadperl-a9984b10c8213b2dc4345882bd808798485d584c.tar.gz
[perl #76814] FETCH called twice - m and s
This fixes m and s. It modifies pp_regcomp to avoid extra magic. It also corrects a bug in sv_catsv_flags, which would still call mg_get(ssv) even without the SV_GMAGIC flag set.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 601a25c5ce..244445281e 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -127,7 +127,7 @@ PP(pp_regcomp)
sv_setsv(tmpstr, sv);
continue;
}
- sv_catsv(tmpstr, msv);
+ sv_catsv_nomg(tmpstr, msv);
}
SvSETMAGIC(tmpstr);
SP = ORIGMARK;
@@ -219,6 +219,14 @@ PP(pp_regcomp)
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