Mercurial > hg > th-libs
changeset 642:3a35db5c1873
Cleanup.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 24 Jan 2020 09:39:09 +0200 |
parents | 9a1ed82abefd |
children | a2bf1ea05b05 |
files | th_regex.c |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/th_regex.c Fri Jan 24 09:36:43 2020 +0200 +++ b/th_regex.c Fri Jan 24 09:39:09 2020 +0200 @@ -423,22 +423,21 @@ if (cch == '?') { - // Check if previous was a count ("*?" or "+?") - if (pnode->mode == TH_RE_MATCH_COUNT_GREEDY) - pnode->mode = TH_RE_MATCH_COUNT_NONGREEDY; - else + // Check if previous was a count if (pnode->mode == TH_RE_MATCH_COUNT_NONGREEDY) { res = THERR_INVALID_DATA; goto exit; } else + if (pnode->mode != TH_RE_MATCH_COUNT_GREEDY) { // Previous token is optional (repeat 0-1 times) - pnode->mode = TH_RE_MATCH_COUNT_NONGREEDY; pnode->repeatMin = 0; pnode->repeatMax = 1; } + + pnode->mode = TH_RE_MATCH_COUNT_NONGREEDY; } else {