diff --git a/src/modal.c b/src/modal.c index ef791ce..b341e5d 100644 --- a/src/modal.c +++ b/src/modal.c @@ -107,7 +107,7 @@ static int run_rule(Rule *r, char *s) { int i; - char c, *a = r->a, *p = s; + char c, *a = r->a; if(rmax) { for(i = rmin; i <= rmax; i++) regs[i] = 0; @@ -116,25 +116,25 @@ run_rule(Rule *r, char *s) while((c = *a)) { if(c == '?') { int regid = (int)*(++a); - char *pcap = walk(p), *reg = regs[regid]; + char *pcap = walk(s), *reg = regs[regid]; if(reg) { /* reg cmp */ - char *rcap = walk(reg), *pp = p; + char *rcap = walk(reg), *pp = s; while(reg < rcap || pp < pcap) if(*reg++ != *pp++) return 0; } else { /* reg set */ - regs[regid] = p; + regs[regid] = s; if(regid < rmin) rmin = regid; if(regid > rmax) rmax = regid; } - a++, p = pcap; + a++, s = pcap; if(!spacer(*a)) while((c = *a) && !spacer(c)) a++; continue; } - if(c != *p) return 0; - a++, p++; + if(c != *s) return 0; + a++, s++; } - c = *p; + c = *s; if(spacer(c)) { char *b = r->b, *reg, *origin = dst_; while((c = *b++)) @@ -143,10 +143,10 @@ run_rule(Rule *r, char *s) else *dst_++ = c; if(dst_ == origin) { - while(*p == ' ') p++; - if(*p == ')' && *(dst_ - 1) == ' ') dst_--; + while(*s == ' ') s++; + if(*s == ')' && *(dst_ - 1) == ' ') dst_--; } - return write_rule(r, p, 0); + return write_rule(r, s, 0); } return 0; }