aboutsummaryrefslogtreecommitdiff
path: root/src/cli.c
diff options
context:
space:
mode:
authorTristan Riehs <tristan.riehs@inria.fr>2026-08-04 23:38:19 +0200
committerTristan Riehs <tristan.riehs@inria.fr>2026-08-04 23:38:19 +0200
commitd10a8424cbf8e529a1b36287d41f7fe6df353e2f (patch)
tree45a44dca1163eca25ccd9035187fba048e6653c8 /src/cli.c
parentca530eb3a2b65dbc7716e557752c87e36aa1879d (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.c33
1 files changed, 14 insertions, 19 deletions
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