From 6980cfbf70a6e0aed58683fb148c405356492fd1 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 20 Jul 2020 18:21:43 +0200 Subject: [PATCH] tweaks: change a 'switch' to 'if', to elide a dummy 'return' --- src/winio.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/winio.c b/src/winio.c index caf4c56d..8e68deab 100644 --- a/src/winio.c +++ b/src/winio.c @@ -845,27 +845,24 @@ int assemble_byte_code(int kbinput) { static int byte = 0; - switch (++digit_count) { - case 1: + if (++digit_count == 1) { /* The first digit is either 0, 1, or 2. */ byte = (kbinput - '0') * 100; return PROCEED; - case 2: + } else if (digit_count == 2) { /* The second digit may be at most 5 if the first was 2. */ if (byte < 200 || kbinput <= '5') { byte += (kbinput - '0') * 10; return PROCEED; } else return kbinput; - case 3: + } else { /* The third digit may be at most 5 if first two were 2 and 5. */ if (byte < 250 || kbinput <= '5') { return (byte + kbinput - '0'); } else return kbinput; } - - return 0; /* FIXME: this suppresses a compilation warning */ } /* Translate a normal ASCII character into its corresponding control code.