diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libnftables.c | 6 | ||||
-rw-r--r-- | src/parser_bison.y | 14 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/libnftables.c b/src/libnftables.c index 56a98ab1..f336dbc3 100644 --- a/src/libnftables.c +++ b/src/libnftables.c @@ -408,8 +408,7 @@ int nft_run_cmd_from_buffer(struct nft_ctx *nft, char *buf, size_t buflen) nlbuf = xzalloc(nlbuflen); snprintf(nlbuf, nlbuflen, "%s\n", buf); - parser_init(nft->nf_sock, &nft->cache, &state, - &msgs, &cmds, nft->debug_mask, &nft->output); + parser_init(nft, &state, &msgs, &cmds); scanner = scanner_init(&state); scanner_push_buffer(scanner, &indesc_cmdline, nlbuf); @@ -445,8 +444,7 @@ int nft_run_cmd_from_filename(struct nft_ctx *nft, const char *filename) if (!strcmp(filename, "-")) filename = "/dev/stdin"; - parser_init(nft->nf_sock, &nft->cache, &state, - &msgs, &cmds, nft->debug_mask, &nft->output); + parser_init(nft, &state, &msgs, &cmds); scanner = scanner_init(&state); if (scanner_read_file(scanner, filename, &internal_location) < 0) { rc = -1; diff --git a/src/parser_bison.y b/src/parser_bison.y index 1ca5d404..e2440be1 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -36,21 +36,19 @@ #include "parser_bison.h" -void parser_init(struct mnl_socket *nf_sock, struct nft_cache *cache, - struct parser_state *state, struct list_head *msgs, - struct list_head *cmds, unsigned int debug_mask, - struct output_ctx *octx) +void parser_init(struct nft_ctx *nft, struct parser_state *state, + struct list_head *msgs, struct list_head *cmds) { memset(state, 0, sizeof(*state)); init_list_head(&state->top_scope.symbols); state->msgs = msgs; state->cmds = cmds; state->scopes[0] = scope_init(&state->top_scope, NULL); - state->ectx.cache = cache; + state->ectx.cache = &nft->cache; state->ectx.msgs = msgs; - state->ectx.nf_sock = nf_sock; - state->ectx.debug_mask = debug_mask; - state->ectx.octx = octx; + state->ectx.nf_sock = nft->nf_sock; + state->ectx.debug_mask = nft->debug_mask; + state->ectx.octx = &nft->output; } static void yyerror(struct location *loc, struct nft_ctx *nft, void *scanner, |