From 02c0bf43d9852f6ec89b2139021f5ef390fbcdf4 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 9 Mar 2025 14:35:42 -0400 Subject: listbas: -D, replace a bunch of ifs with switches. --- listamsb.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/listamsb.c b/listamsb.c index afd4f8a..27a892c 100644 --- a/listamsb.c +++ b/listamsb.c @@ -605,20 +605,28 @@ int need_space_between(int ext1, int ext2, unsigned char t1, unsigned char t2) { if(!ext1) { /* IF, THEN, and operators like AND/OR/NOT always get a space after them, for readability. */ - if(t1 == TOK_IF) return 1; - if(t1 == TOK_THEN) return 1; - if(t1 == TOK_ELSE) return 1; - if(t1 == TOK_AND) return 1; - if(t1 == TOK_OR) return 1; - if(t1 == TOK_NOT) return 1; + switch(t1) { + case TOK_IF: + case TOK_THEN: + case TOK_ELSE: + case TOK_AND: + case TOK_OR: + case TOK_NOT: + return 1; + default: break; + } } if(!ext2) { /* these always get a space before them, for readability. */ - if(t2 == TOK_THEN) return 1; - if(t2 == TOK_AND) return 1; - if(t2 == TOK_OR) return 1; - if(t2 == TOK_NOT) return 1; + switch(t2) { + case TOK_THEN: + case TOK_AND: + case TOK_OR: + case TOK_NOT: + return 1; + default: break; + } } if(t1 >= 0x80 && isalnum(t1last)) { -- cgit v1.2.3