From: Yves Orton Date: Sun, 3 Jun 2007 17:21:55 +0000 (+0200) Subject: Re: BBC(Bleadperl Breaks CPAN) Today: String::Multibyte X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c490c714018f95e6fedac7e6bef61da086a72f4c;p=p5sagit%2Fp5-mst-13.2.git Re: BBC(Bleadperl Breaks CPAN) Today: String::Multibyte Message-ID: <9b18b3110706030821u39460f96ic342dda8ba9fcdf7@mail.gmail.com> p4raw-id: //depot/perl@31328 --- diff --git a/regcomp.c b/regcomp.c index fef161b..f65b3e6 100644 --- a/regcomp.c +++ b/regcomp.c @@ -1966,7 +1966,8 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs } if ( count == 1 ) { SV **tmp = av_fetch( revcharmap, idx, 0); - char *ch = SvPV_nolen( *tmp ); + STRLEN len; + char *ch = SvPV( *tmp, len ); DEBUG_OPTIMISE_r({ SV *sv=sv_newmortal(); PerlIO_printf( Perl_debug_log, @@ -1985,11 +1986,9 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs str=STRING(convert); STR_LEN(convert)=0; } - while (*ch) { + STR_LEN(convert) += len; + while (len--) *str++ = *ch++; - STR_LEN(convert)++; - } - } else { #ifdef DEBUGGING if (state>1) diff --git a/t/op/pat.t b/t/op/pat.t index 367b0bb..dcedd28 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -4381,6 +4381,18 @@ sub kt } } } +{ + local $Message = "BBC(Bleadperl Breaks CPAN) Today: String::Multibyte"; + my $re = qr/(?:[\x00-\xFF]{4})/; + my $hyp = "\0\0\0-"; + my $esc = "\0\0\0\\"; + + my $str = "$esc$hyp$hyp$esc$esc"; + my @a = ($str =~ /\G(?:\Q$esc$esc\E|\Q$esc$hyp\E|$re)/g); + + iseq(0+@a,3); + iseq(join('=', @a),"$esc$hyp=$hyp=$esc$esc"); +} # Test counter is at bottom of file. Put new tests above here. #------------------------------------------------------------------- # Keep the following tests last -- they may crash perl @@ -4462,7 +4474,7 @@ ok($@=~/\QSequence \k... not terminated in regex;\E/); iseq(0+$::test,$::TestCount,"Got the right number of tests!"); # Don't forget to update this! BEGIN { - $::TestCount = 1948; + $::TestCount = 1950; print "1..$::TestCount\n"; }