Skip to content

Commit

Permalink
Remove unused variable
Browse files Browse the repository at this point in the history
`prompt_flag` in `console.c` is specified as static and the only usage
is the if statement at line 583 and the only assignment to it is at line
588 which assigns 1 to `prompt_flag`. Since no other code can modify
this variable, it can be removed.
  • Loading branch information
millaker committed Mar 6, 2024
1 parent 5dcb1bd commit 9a135e0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions console.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ int show_entropy = 0;
static cmd_element_t *cmd_list = NULL;
static param_element_t *param_list = NULL;
static bool block_flag = false;
static bool prompt_flag = true;

/* Am I timing a command that has the console blocked? */
static bool block_timing = false;
Expand Down Expand Up @@ -581,13 +580,12 @@ static int cmd_select(int nfds,
if (web_fd != -1)
FD_SET(web_fd, readfds);

if (infd == STDIN_FILENO && prompt_flag) {
if (infd == STDIN_FILENO) {
char *cmdline = linenoise(prompt);
if (cmdline)
interpret_cmd(cmdline);
fflush(stdout);
prompt_flag = true;
} else if (infd != STDIN_FILENO) {
} else {
char *cmdline = readline();
if (cmdline)
interpret_cmd(cmdline);
Expand Down

0 comments on commit 9a135e0

Please sign in to comment.