add more compile-time diagnostics, implement fixes for them

Before, a lot of common errors went unnoticed, due to insufficient
compiler diagnostics. This commit fixes this by adding a lot of new
diagnostics, and fixing the issues found by this.
This commit is contained in:
Lion Kortlepel
2022-09-26 12:02:05 +02:00
parent 501fddadc6
commit 24c98eb2b2
15 changed files with 141 additions and 85 deletions

View File

@@ -7,7 +7,7 @@
static struct termios old, current;
void initTermios(int echo) {
static void initTermios(int echo) {
tcgetattr(0, &old); /* grab old terminal i/o settings */
current = old; /* make new settings same as old settings */
current.c_lflag &= ~ICANON; /* disable buffered i/o */
@@ -19,7 +19,7 @@ void initTermios(int echo) {
tcsetattr(0, TCSANOW, &current); /* use these new terminal i/o settings now */
}
void resetTermios(void) {
static void resetTermios(void) {
tcsetattr(0, TCSANOW, &old);
}
@@ -47,7 +47,7 @@ TEST_CASE("init and reset termios") {
}
}
char getch_(int echo) {
static char getch_(int echo) {
char ch;
initTermios(echo);
read(STDIN_FILENO, &ch, 1);