diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-01-05 16:47:06 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-01-05 16:47:06 +0000 |
commit | b9ad30b40cf004f5ea6fd7a945a950cf873aed7b (patch) | |
tree | cce3531a601494f58ec6bc8c9e674dfeea2fad51 /pp_ctl.c | |
parent | e2560c3357339d22d0d9ac926b8e57ce241c1fb6 (diff) | |
download | perl-b9ad30b40cf004f5ea6fd7a945a950cf873aed7b.tar.gz |
Make Perl_pregcomp() use SvUTF8() of the pattern, rather than the flag
bit in pmflags, to decide whether the pattern is UTF-8.
p4raw-id: //depot/perl@32851
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -148,8 +148,18 @@ PP(pp_regcomp) if (PL_op->op_flags & OPf_SPECIAL) PL_reginterp_cnt = I32_MAX; /* Mark as safe. */ - if (DO_UTF8(tmpstr)) - pm_flags |= RXf_UTF8; + 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, + as the compiler now honours the SvUTF8 flag on tmpstr. */ + STRLEN len; + const char *const p = SvPV(tmpstr, len); + tmpstr = newSVpvn_flags(p, len, SVs_TEMP); + } + assert(!(pm_flags & RXf_UTF8)); if (eng) PM_SETRE(pm, CALLREGCOMP_ENG(eng, tmpstr, pm_flags)); |