From d03f359f4c5e3b626ce4cff871073d1d6c21316e Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sat, 27 Apr 2024 10:51:50 -0700 Subject: [PATCH] Better rules lookup --- src/modal.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/modal.c b/src/modal.c index 05833e2..c4413de 100644 --- a/src/modal.c +++ b/src/modal.c @@ -196,18 +196,17 @@ find_rule(char *s, char *cap) if(*s == '(') s++, cap--; while(r < rules_) { char *ss = s, *a = r->a; - if(a) - while(*ss++ == *a++) - if(!*a) return r; + while(*ss++ == *a++) + if(!*a && ss == cap) return r; r++; } return r; } static void -echo_rule(Rule *r, char *field) +echo_rule(Rule *r, char *s) { - char c, *s = field; + char c; putc('(', stdout); while((c = *s++)) { unsigned int rid;