Walk over incompiled registers

This commit is contained in:
Devine Lu Linvega 2024-04-24 11:18:06 -07:00
parent 4535c11017
commit 3136ae834f
1 changed files with 4 additions and 6 deletions

View File

@ -105,11 +105,11 @@ write_rule(Rule *r, char *s, int create)
static int
apply_rule(Rule *r, char *s)
{
char c, *a = r->a, *regs[0x08] = {NULL};
char c, *a = r->a, *regs[0x08] = {NULL}, *reg;
/* phase: match rule */
while((c = *a)) {
if(c == '?') {
char *pcap = walk(s), *reg = NULL;
char *pcap = walk(s);
unsigned int id = *(++a) - '0';
if((reg = regs[id])) { /* reg cmp */
char *rcap = walk(reg), *pp = s;
@ -129,11 +129,9 @@ apply_rule(Rule *r, char *s)
if(!(c = *s) || spacer(c)) {
char *b = r->b, *origin = dst_;
while((c = *b++)) {
if(c == '?') {
char *reg = NULL;
if(c == '?' && (unsigned int)(*b - '0') < 9) {
unsigned int id = *b - '0';
if(id < r->ptr) reg = regs[id];
if(reg) {
if((reg = regs[id])) {
b++;
if(!write_reg(r->key[id], reg) && dst_ != origin) dst_--;
} else