From: Jarkko Hietaniemi Date: Thu, 3 Jan 2002 01:52:04 +0000 (+0000) Subject: Off-by-one is my middle name. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=93c50829d83553b4361dbfd23cb665fcba82d307;p=p5sagit%2Fp5-mst-13.2.git Off-by-one is my middle name. p4raw-id: //depot/perl@14031 --- diff --git a/regexec.c b/regexec.c index 51b55f6..75ea152 100644 --- a/regexec.c +++ b/regexec.c @@ -960,7 +960,7 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta c1 = *(U8*)m; c2 = PL_fold_locale[c1]; do_exactf: - e = do_utf8 ? s + ln - 1 : strend - ln; + e = do_utf8 ? s + ln : strend - ln; if (norun && e < s) e = s; /* Due to minlen logic of intuit() */ @@ -980,16 +980,14 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta U8 tmpbuf [UTF8_MAXLEN+1]; U8 foldbuf[UTF8_MAXLEN_FOLD+1]; STRLEN len, foldlen; - char* se; if (c1 == c2) { while (s <= e) { c = utf8_to_uvchr((U8*)s, &len); if ( c == c1 && (ln == len || - ((se = e + 1) && - !ibcmp_utf8(s, &se, 0, do_utf8, - m, 0 , ln, UTF))) + ibcmp_utf8(s, 0 , 0, do_utf8, + m, 0 , ln, UTF)) && (norun || regtry(prog, s)) ) goto got_it; else { @@ -1025,9 +1023,8 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta if ( (c == c1 || c == c2) && (ln == len || - ((se = e + 1) && - !ibcmp_utf8(s, &se, 0, do_utf8, - m, 0, ln, UTF))) + ibcmp_utf8(s, 0, 0, do_utf8, + m, 0, ln, UTF)) && (norun || regtry(prog, s)) ) goto got_it; else {