]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
cli: Drop pointless check in cli_append_multiline()
authorPhil Sutter <phil@nwl.cc>
Thu, 1 Mar 2018 14:00:27 +0000 (15:00 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 2 Mar 2018 10:46:56 +0000 (11:46 +0100)
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>
src/cli.c

index ec4d2a6f2046d5bd42f576af665960ca27923820..eb60d01dad3dcdf5ea6f2388d24dfbdc2ce49477 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
 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;
 }