From: Larry Wall Date: Thu, 3 Sep 1998 12:49:13 +0000 (-0700) Subject: index() applied BM optimization to wrong argument X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fb5b0d601e4bb1f798f9559cbb4b2e9d69aa3eed;p=p5sagit%2Fp5-mst-13.2.git index() applied BM optimization to wrong argument Message-Id: <199809031949.MAA29566@wall.org>, <199809060004.RAA23792@wall.org> p4raw-id: //depot/maint-5.005/perl@1783 --- diff --git a/op.c b/op.c index 421a093..6502673 100644 --- a/op.c +++ b/op.c @@ -4455,6 +4455,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 431c5fa..13590c0 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 */