Regular expression matching fix simplification
kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=370a899bec838291da4707b65527678ad753cde6
commit 370a899bec838291da4707b65527678ad753cde6 Author: Kim Woelders <k...@woelders.dk> Date: Sat Nov 13 07:29:53 2021 +0100 Regular expression matching fix simplification --- src/regex.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/regex.c b/src/regex.c index 3504f8dd..4e377e5a 100644 --- a/src/regex.c +++ b/src/regex.c @@ -89,7 +89,7 @@ matchregexp(const char *rx, const char *s) } if ((!rx[l]) && (s[lenr])) return 0; - for (i = lenr; i < len; i++) + for (i = lenr; i < len;) { if (rx[l]) l++; @@ -102,15 +102,6 @@ matchregexp(const char *rx, const char *s) i = isafter(i, s, rx2); if (i < 0) return 0; - // Because the for loop will increment i (the index - // into string s) at the end of this block, but i now - // already points to the next char in s, this next char - // gets ignored. - // Without this next decrement, if the regex is *bla, - // it will incorrectly say that blax matches, although - // correctly say that blaxy doesn't. Ie. char x is skipped - if (i > 0) - i--; } else { --
Read more here: Source link