tregex: decrease rs->rec when re_rec() ends - neatvi - [fork] simple vi-type ed… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 55d93278b651ba9a0e42bfa9169be918731c0080 | |
parent faba1abe11f6abdeea5b9b8da810638e5eb3f3a1 | |
Author: Ali Gholami Rudi <[email protected]> | |
Date: Thu, 17 Feb 2022 21:01:22 +0330 | |
regex: decrease rs->rec when re_rec() ends | |
Diffstat: | |
M regex.c | 4 +++- | |
1 file changed, 3 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/regex.c b/regex.c | |
t@@ -547,8 +547,9 @@ void regfree(regex_t *preg) | |
static int re_rec(struct regex *re, struct rstate *rs) | |
{ | |
struct rinst *ri = NULL; | |
- if (++(rs->dep) >= NDEPT) | |
+ if (rs->dep >= NDEPT) | |
return 1; | |
+ rs->dep++; | |
while (1) { | |
ri = &re->p[rs->pc]; | |
if (ri->ri == RI_ATOM) { | |
t@@ -578,6 +579,7 @@ static int re_rec(struct regex *re, struct rstate *rs) | |
} | |
break; | |
} | |
+ rs->dep--; | |
return ri->ri != RI_MATCH; | |
} | |