diff options
author | Phil Sutter <phil@nwl.cc> | 2018-03-01 15:00:27 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-03-02 11:46:56 +0100 |
commit | f51ed1db70abdbb909e81bc670ffdfa05f421257 (patch) | |
tree | 912d1a0f32f30afb0be41d61f13d2e52a6c4f528 /src | |
parent | 263c445ef4ae30eb9d6b99375dae150105a2eb04 (diff) |
cli: Drop pointless check in cli_append_multiline()
The function is called from cli_complete after it has checked for line
to be != NULL. The other part of the conditional, namely multiline being
NULL, is perfectly valid (if the last read line didn't end with
backslash. Hence drop the conditional completely.
Since variable eof is not used anywhere outside of the dropped
conditional, get rid of it completely.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/cli.c | 12 |
1 files changed, 2 insertions, 10 deletions
@@ -38,21 +38,13 @@ static struct nft_ctx *cli_nft; static char histfile[PATH_MAX]; static char *multiline; -static bool eof; static char *cli_append_multiline(char *line) { + size_t len = strlen(line); bool complete = false; - size_t len; char *s; - if (line == NULL && multiline == NULL) { - eof = true; - return NULL; - } - - len = strlen(line); - if (len == 0) return NULL; @@ -155,7 +147,7 @@ int cli_init(struct nft_ctx *nft) read_history(histfile); history_set_pos(history_length); - while (!eof) + while (true) rl_callback_read_char(); return 0; } |