This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
index() applied BM optimization to wrong argument
authorLarry Wall <larry@wall.org>
Thu, 3 Sep 1998 12:49:13 +0000 (05:49 -0700)
committerGraham Barr <gbarr@pobox.com>
Mon, 7 Sep 1998 20:33:11 +0000 (20:33 +0000)
Message-Id: <199809031949.MAA29566@wall.org>, <199809060004.RAA23792@wall.org>

p4raw-id: //depot/maint-5.005/perl@1783

op.c
util.c

diff --git a/op.c b/op.c
index 421a093..6502673 100644 (file)
--- 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 (file)
--- 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 */