From d10a8424cbf8e529a1b36287d41f7fe6df353e2f Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Tue, 4 Aug 2026 23:38:19 +0200 Subject: Get rid of the non-reloadable version It creates two different versions of the code for no valid reason. dynamically loading the display is not that mystical in the end. --- src/cli.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'src/cli.c') diff --git a/src/cli.c b/src/cli.c index bf944e0..0ea3eed 100644 --- a/src/cli.c +++ b/src/cli.c @@ -18,19 +18,27 @@ cli_display_calc(int x, int y) int cli_read_input(void) { - char *txt = readline(""); + char *txt = readline(NULL); - if ((!txt) || (txt[0] == '\0')) { + if (!txt) + { return DISP_QUIT; } - else if (txt[0] == 'q') { + else if (txt[0] == '\0') + { free(txt); return DISP_QUIT; } -#ifndef NDEBUG - if ((*txt == 'r') || (*txt == 'g')) + else if (txt[0] == 'q') + { + free(txt); + return DISP_QUIT; + } + else if ((txt[0] == 'r') || (txt[0] == 'g')) + { + free(txt); return DISP_RELOAD; -#endif + } int res = atoi(txt); free(txt); @@ -45,18 +53,5 @@ cli_display_res(bool ok, int ms) void cli_destroy(void) {} -#ifndef NDEBUG void *cli_pre_reload(void) {return NULL;} void cli_post_reload(void *) {} -#endif - -#ifdef NDEBUG -static struct disp __cli_disp = { - .init = cli_init, - .display_calc = cli_display_calc, - .read_input = cli_read_input, - .display_res = cli_display_res, - .destroy = cli_destroy -}; -struct disp *cli_disp = &__cli_disp; -#endif -- cgit v1.2.3