From 85da7ee692072c643939e9f4b24fbd1e74e64e70 Mon Sep 17 00:00:00 2001 From: Akinori Ito Date: Thu, 15 Nov 2001 00:32:13 +0000 Subject: Update to w3m-0.2.1-inu-1.6. --- regex.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'regex.c') diff --git a/regex.c b/regex.c index 28686ee..e926872 100644 --- a/regex.c +++ b/regex.c @@ -210,6 +210,7 @@ regmatch(regexchar * re, char *str, int len, int firstp, char **lastpos) char *lpos, *llpos = NULL; longchar k; + *lastpos = NULL; #ifdef REGEX_DEBUG debugre(re, str); #endif /* REGEX_DEBUG */ @@ -220,21 +221,16 @@ regmatch(regexchar * re, char *str, int len, int firstp, char **lastpos) re++; } else if (re->mode & RE_ANYTIME) { - short matched = 0, ok = 0; - do { + short matched, ok = 0; + for (;;) { + matched = 0; if (regmatch(re + 1, p, ep - p, firstp, &lpos) == 1) { llpos = lpos; matched = 1; - } - else if (matched) { ok = 1; - break; } - if (p >= ep) { - if (matched) - ok = 1; + if (p >= ep) break; - } #ifdef JP_CHARSET if (IS_KANJI1(*p)) { k = RE_KANJI(p); @@ -243,8 +239,6 @@ regmatch(regexchar * re, char *str, int len, int firstp, char **lastpos) *lastpos = llpos; p += 2; } - else if (matched) - ok = 1; else break; } @@ -257,12 +251,10 @@ regmatch(regexchar * re, char *str, int len, int firstp, char **lastpos) if (lastpos != NULL) *lastpos = llpos; } - else if (matched) - ok = 1; else - break; + break; } - } while (!ok); + } if (lastpos != NULL) *lastpos = llpos; return ok; -- cgit v1.2.3