Do not pass regs through funciton

This commit is contained in:
Devine Lu Linvega 2024-04-25 18:39:17 -07:00
parent 47b80e126e
commit eaa1f92347
1 changed files with 5 additions and 5 deletions

View File

@ -106,10 +106,10 @@ write_rule(Rule *r, char *s, int create)
} }
static int static int
apply_rule(Rule *r, char **regs, char *s) apply_rule(Rule *r, char *s)
{ {
unsigned int i, id; unsigned int i, id;
char c, *a = r->a, *b = r->b, *origin = dst_, *reg; char c, *a = r->a, *b = r->b, *origin = dst_, *reg, *regs[0x08];
/* phase: clean registers */ /* phase: clean registers */
for(i = 0; i < r->ptr; i++) for(i = 0; i < r->ptr; i++)
regs[i] = NULL; regs[i] = NULL;
@ -198,7 +198,7 @@ compile_rule(Rule *r, int id, char *src)
static int static int
rewrite(void) rewrite(void)
{ {
char c, last = 0, *cap, *s = src_, *regs[0x08]; char c, last = 0, *cap, *s = src_;
while(*s == ' ') s++; while(*s == ' ') s++;
while((c = *s)) { while((c = *s)) {
if(spacer(last)) { if(spacer(last)) {
@ -214,11 +214,11 @@ rewrite(void)
if(c == '?' && s[1] == '(') { if(c == '?' && s[1] == '(') {
cap = walk(s + 1), compile_rule(&lambda, -1, s + 2), s = cap; cap = walk(s + 1), compile_rule(&lambda, -1, s + 2), s = cap;
while(*s == ' ') s++; while(*s == ' ') s++;
return apply_rule(&lambda, regs, s); return apply_rule(&lambda, s);
} }
/* phase: match */ /* phase: match */
for(r = rules; r < rules_; r++) for(r = rules; r < rules_; r++)
if(apply_rule(r, regs, s)) return 1; if(apply_rule(r, s)) return 1;
} }
*dst_++ = last = c; *dst_++ = last = c;
s++; s++;