diff options
author | Wojtek Kosior <kwojtus@protonmail.com> | 2019-11-26 16:28:36 +0100 |
---|---|---|
committer | Wojtek Kosior <kwojtus@protonmail.com> | 2019-11-26 16:28:36 +0100 |
commit | 3c1218507acb84c95818a044eefb51fc8e5fa4c7 (patch) | |
tree | ae2a2bc578ee0945aa93f33af6306c2082fe6ced | |
parent | 6eba61fede40efda3651bceb559f8d1fa372fa73 (diff) | |
download | rpi-MMU-example-3c1218507acb84c95818a044eefb51fc8e5fa4c7.tar.gz rpi-MMU-example-3c1218507acb84c95818a044eefb51fc8e5fa4c7.zip |
don't use switch statement with fallthrough
-rw-r--r-- | PL0_test.c | 14 | ||||
-rw-r--r-- | kernel.c | 14 |
2 files changed, 12 insertions, 16 deletions
@@ -22,13 +22,11 @@ void PL0_main(void) while (1) { - char c; - switch(c = uart_getc()) - { - case '\r': - uart_putc('\n'); - default: - uart_putc(c); - } + char c = uart_getc(); + + uart_putc(c); + + if (c == '\r') + uart_putc('\n'); } } @@ -35,13 +35,11 @@ void kernel_main(uint32_t r0, uint32_t r1, uint32_t atags) while (1) { - char c; - switch(c = uart_getc()) - { - case '\r': - uart_putc('\n'); - default: - uart_putc(c); - } + char c = uart_getc(); + + uart_putc(c); + + if (c == '\r') + uart_putc('\n'); } } |