tregex: decrease rs->rec when re_rec() ends - neatvi - [fork] simple vi-type editor with UTF-8 support
HTML git clone git://src.adamsgaard.dk/neatvi
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR commit 55d93278b651ba9a0e42bfa9169be918731c0080
DIR parent faba1abe11f6abdeea5b9b8da810638e5eb3f3a1
HTML Author: Ali Gholami Rudi <ali@rudi.ir>
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(-)
---
DIR 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;
}