From: Yves Orton Date: Fri, 20 Oct 2006 12:38:13 +0000 (+0200) Subject: only do \C hackery if \C is seen X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=526550006a9e67e99d92fcb1eb05fe7b52d5172a;p=p5sagit%2Fp5-mst-13.2.git only do \C hackery if \C is seen Subject: Re: utf8 regexp performance problem Message-ID: <9b18b3110610200338k5df1d3afpf829fbc0f3663a75@mail.gmail.com> p4raw-id: //depot/perl@29063 --- diff --git a/mg.c b/mg.c index 3ab49c0..7c19c7e 100644 --- a/mg.c +++ b/mg.c @@ -861,8 +861,13 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) TAINT_NOT; sv_setpvn(sv, s, i); PL_tainted = oldtainted; - if (RX_MATCH_UTF8(rx) && (!i || is_utf8_string((U8*)s, i))) + if ( (rx->reganch & ROPT_CANY_SEEN) + ? (RX_MATCH_UTF8(rx) + && (!i || is_utf8_string((U8*)s, i))) + : (RX_MATCH_UTF8(rx)) ) + { SvUTF8_on(sv); + } else SvUTF8_off(sv); if (PL_tainting) {