]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
scanner: remove parser_state->indesc_idx
authorLaurent Fasnacht <fasnacht@protonmail.ch>
Mon, 10 Feb 2020 10:17:28 +0000 (10:17 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 13 Feb 2020 12:03:53 +0000 (13:03 +0100)
Now that we have a proper stack implementation, we don't need an
additional counter for the number of buffer state pushed.

Signed-off-by: Laurent Fasnacht <fasnacht@protonmail.ch>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/parser.h
src/scanner.l

index 66db92d8d772037e4f93fd066c035875895ad074..636d1c8810e48b323c1f05f81fff00c36f24ed4a 100644 (file)
@@ -15,7 +15,6 @@
 
 struct parser_state {
        struct input_descriptor         *indesc;
-       unsigned int                    indesc_idx;
        struct list_head                indesc_list;
 
        struct list_head                *msgs;
index 9e19577db5d214ab9dadc9aa81766253ad5ae6f7..ed29833b6fc49e648d5da11a2dd3c78c439cb295 100644 (file)
@@ -674,12 +674,10 @@ static void scanner_push_indesc(struct parser_state *state,
                list_add(&indesc->list, &state->indesc->list);
 
        state->indesc = indesc;
-       state->indesc_idx++;
 }
 
 static void scanner_pop_indesc(struct parser_state *state)
 {
-       state->indesc_idx--;
        if (!list_empty(&state->indesc_list)) {
                state->indesc = list_entry(state->indesc->list.prev,
                                           struct input_descriptor, list);
@@ -969,10 +967,6 @@ void scanner_destroy(struct nft_ctx *nft)
 {
        struct parser_state *state = yyget_extra(nft->scanner);
 
-       do {
-               yypop_buffer_state(nft->scanner);
-       } while (state->indesc_idx--);
-
        input_descriptor_list_destroy(state);
        yylex_destroy(nft->scanner);
 }