summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-10-30 16:12:02 +0000
committerDavid Mitchell <davem@iabyn.com>2012-06-13 13:25:48 +0100
commit8005796e5264eb0df85cf3c0e4517ca3d769650f (patch)
tree06ca6490cb515ba51ef62d6e838c3cb24beb45fa /pp_ctl.c
parent525ef3318377af74a8bc34655479e0602a0855cf (diff)
downloadperl-8005796e5264eb0df85cf3c0e4517ca3d769650f.tar.gz
Revert 4 regex commits to ease rebasing
Revert "Remove some repeated code in pp_regcomp" This reverts commit 3e1022372a8200bc4c7354e0f588c7f71584a888. Revert "regcomp.c: Use no_mg for 2nd fetch of pattern" This reverts commit 3e0b93e82af0f1a033bcdb918b413113f1d61cf0. ` Revert "PATCH: [perl #101940]: BBC Tk" This reverts commit 11951bcbfcaf4c260b0da0421e72fc80b4654f17. Revert "Fix =~ $str_overloaded (5.10 regression)" This reverts commit 15d9c083b08647e489d279a1059b4f14a3df187b. These four recent commits on the blead branch overlap with work on the re_eval branch. To make rebasing re_eval easier, revert them at the beginning of the re_eval branch. Any remaining value will be re-added later in the re_eval branch.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 669fb2776a..2cde6658aa 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -205,7 +205,9 @@ PP(pp_regcomp)
if (PL_op->op_flags & OPf_SPECIAL)
PL_reginterp_cnt = I32_MAX; /* Mark as safe. */
- if (!DO_UTF8(tmpstr) && SvUTF8(tmpstr)) {
+ if (DO_UTF8(tmpstr)) {
+ assert (SvUTF8(tmpstr));
+ } else if (SvUTF8(tmpstr)) {
/* Not doing UTF-8, despite what the SV says. Is this only if
we're trapped in use 'bytes'? */
/* Make a copy of the octet sequence, but without the flag on,
@@ -214,11 +216,19 @@ PP(pp_regcomp)
const char *const p = SvPV(tmpstr, len);
tmpstr = newSVpvn_flags(p, len, SVs_TEMP);
}
- else if (SvAMAGIC(tmpstr) || SvGMAGICAL(tmpstr)) {
+ else if (SvAMAGIC(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