From: Larry Wall Date: Sat, 5 Sep 1998 23:41:42 +0000 (+0000) Subject: index() applied BM optimization to wrong argument X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0b71040ecef552254b590fe9935cf4942b087ec2;p=p5sagit%2Fp5-mst-13.2.git index() applied BM optimization to wrong argument p4raw-id: //depot/perl@1779 --- diff --git a/op.c b/op.c index 33a9efd..53fb8c1 100644 --- a/op.c +++ b/op.c @@ -4686,6 +4686,8 @@ ck_index(OP *o) { if (o->op_flags & OPf_KIDS) { OP *kid = cLISTOPo->op_first->op_sibling; /* get past pushmark */ + if (kid) + kid = kid->op_sibling; /* get past "big" */ if (kid && kid->op_type == OP_CONST) fbm_compile(((SVOP*)kid)->op_sv, 0); } diff --git a/util.c b/util.c index e079d42..5be4969 100644 --- a/util.c +++ b/util.c @@ -900,10 +900,11 @@ fbm_compile(SV *sv, U32 flags /* not used yet */) register unsigned char *s; register unsigned char *table; register U32 i; - register U32 len = SvCUR(sv); + STRLEN len; I32 rarest = 0; U32 frequency = 256; + s = SvPV_force(sv, len); sv_upgrade(sv, SVt_PVBM); if (len > 255 || len == 0) /* TAIL might be on on a zero-length string. */ return; /* can't have offsets that big */