From 13a9107aac37e67e8ab42faaa4fd3b52bdb7c406 Mon Sep 17 00:00:00 2001 From: dcs Date: Sun, 9 Jul 2000 17:36:53 +0000 Subject: Since g->moffset points to the _maximum_ offset at which the must string may be found (from the beginning of the pattern), the point at which must is found minus that offset may actually point to some place before the start of the text. In that case, make start = start. Alternatively, this could be tested for in the preceding if, but it did not occur to me. :-) Caught by: regex(3) test code --- lib/libc/regex/engine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libc') diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c index a12538f..04844ba 100644 --- a/lib/libc/regex/engine.c +++ b/lib/libc/regex/engine.c @@ -236,7 +236,7 @@ int eflags; /* Adjust start according to moffset, to speed things up */ if (g->moffset > -1) - start = dp - g->moffset; + start = ((dp - g->moffset) < start) ? start : dp - g->moffset; /* this loop does only one repetition except for backrefs */ for (;;) { -- cgit v1.1