aboutsummaryrefslogtreecommitdiffstats
path: root/regex.c
diff options
context:
space:
mode:
authorAkinori Ito <aito@eie.yz.yamagata-u.ac.jp>2001-11-15 00:32:13 +0000
committerAkinori Ito <aito@eie.yz.yamagata-u.ac.jp>2001-11-15 00:32:13 +0000
commit85da7ee692072c643939e9f4b24fbd1e74e64e70 (patch)
tree9fc63298cf968fa560a9e3cf9b6c84516032fca8 /regex.c
parentUpdates from 0.2.1 into 0.2.1-inu-1.5 (diff)
downloadw3m-85da7ee692072c643939e9f4b24fbd1e74e64e70.tar.gz
w3m-85da7ee692072c643939e9f4b24fbd1e74e64e70.zip
Update to w3m-0.2.1-inu-1.6.
Diffstat (limited to '')
-rw-r--r--regex.c22
1 files changed, 7 insertions, 15 deletions
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;