summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2010-12-04 15:26:38 +0100
committerYves Orton <demerphq@gmail.com>2010-12-04 15:26:38 +0100
commit5b6010b3c3f40e7db51b877d5227c4c80caaa5bb (patch)
tree847e7bc0efca768ab59220a4f5b306f6efc59b4c /regcomp.c
parentd6bd454d28fd8c0d7ab9553e128a7acccea40a5c (diff)
downloadperl-5b6010b3c3f40e7db51b877d5227c4c80caaa5bb.tar.gz
make empty string regexp stringify to the same thing regardless of unicode flags
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/regcomp.c b/regcomp.c
index 5974fdb86d..59f11f5d81 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -4413,8 +4413,10 @@ Perl_re_compile(pTHX_ SV * const pattern, U32 pm_flags)
DEBUG_r(if (!PL_colorset) reginitcolors());
- RExC_utf8 = RExC_orig_utf8 = SvUTF8(pattern);
-
+ exp = SvPV(pattern, plen);
+ xend = exp + plen;
+ /* ignore the utf8ness if the string is 0 length */
+ RExC_utf8 = RExC_orig_utf8 = plen > 0 && SvUTF8(pattern);
/****************** LONG JUMP TARGET HERE***********************/
/* Longjmp back to here if have to switch in midstream to utf8 */
@@ -4423,9 +4425,6 @@ Perl_re_compile(pTHX_ SV * const pattern, U32 pm_flags)
}
if (jump_ret == 0) { /* First time through */
- exp = SvPV(pattern, plen);
- xend = exp + plen;
-
DEBUG_COMPILE_r({
SV *dsv= sv_newmortal();
RE_PV_QUOTED_DECL(s, RExC_utf8,