From e84ef37c5dfd3d796ced3ab781bb251c6cdb26cf Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sun, 28 Apr 2024 20:37:53 -0700 Subject: [PATCH] Housekeeping --- src/modal.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/modal.c b/src/modal.c index 1590db5..8d20a94 100644 --- a/src/modal.c +++ b/src/modal.c @@ -34,10 +34,10 @@ walk(char *s) static int sint(char *s) { - int acc = 0; + int r = 0; char c; - while((c = *s++) && c > 0x20) acc *= 10, acc += c - '0'; - return acc; + while((c = *s++) && c > 0x20) r = r * 10 + c - '0'; + return r; } static void @@ -97,13 +97,9 @@ write_reg(char r, char *reg) char c, *cap = walk(reg); switch(r) { case '>': /* op: output */ - case ':': - device_write(reg); - return; + case ':': device_write(reg); return; case '<': /* op: input */ - case '~': - device_read(); - return; + case '~': device_read(); return; case '^': /* op: join */ if(*reg == '(') reg++, --cap; while(reg < cap && (c = *reg++)) @@ -244,8 +240,7 @@ rewrite(void) while(*s == ' ') s++; cap = walk(s), r = find_rule(s, cap); if(r != NULL) { - if(!quiet) - fprintf(stderr, ">< (%s) (%s)\n", r->a, r->b); + if(!quiet) fprintf(stderr, ">< (%s) (%s)\n", r->a, r->b); r->a = 0; } while(*cap == ' ') cap++; @@ -256,8 +251,7 @@ rewrite(void) r = rules_, r->id = rules_ - rules - 1; s = parse_frag(&r->b, parse_frag(&r->a, s + 2)); if(*r->a) { - if(!quiet) - fprintf(stderr, "<> (%s) (%s)\n", r->a, r->b); + if(!quiet) fprintf(stderr, "<> (%s) (%s)\n", r->a, r->b); rules_++; } while(*s == ' ') s++;