diff options
| author | Tristan Riehs <tristan.riehs@inria.fr> | 2026-08-04 23:38:19 +0200 |
|---|---|---|
| committer | Tristan Riehs <tristan.riehs@inria.fr> | 2026-08-04 23:38:19 +0200 |
| commit | d10a8424cbf8e529a1b36287d41f7fe6df353e2f (patch) | |
| tree | 45a44dca1163eca25ccd9035187fba048e6653c8 /src/cli.c | |
| parent | ca530eb3a2b65dbc7716e557752c87e36aa1879d (diff) | |
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.
Diffstat (limited to 'src/cli.c')
| -rw-r--r-- | src/cli.c | 33 |
1 files changed, 14 insertions, 19 deletions
@@ -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 |
