Hi,

On Thu, 2017-08-17 at 12:32 +0200, Phil Sutter wrote:
> On Wed, Aug 16, 2017 at 10:43:09PM +0200, Eric Leblond wrote:
> [...]
> > diff --git a/src/libnftables.c b/src/libnftables.c
> > index c50c068..a42e8f1 100644
> > --- a/src/libnftables.c
> > +++ b/src/libnftables.c
> > @@ -86,6 +86,7 @@ struct nft_ctx *nft_context_new(void)
> >     ctx->nf_sock = netlink_open_sock();
> >  
> >     init_list_head(&ctx->cache.list);
> > +   init_list_head(&ctx->output.msgs);
> >  
> >     ctx->output.ctx = ctx;
> >     ctx->output.print = nft_print;
> > @@ -108,6 +109,7 @@ void nft_context_free(struct nft_ctx *nft)
..
> >     struct parser_state state;
> > -   LIST_HEAD(msgs);
> >     void *scanner;
> >  
> > -   parser_init(nft->nf_sock, &nft->cache, &state, &msgs);
> > +   parser_init(nft->nf_sock, &nft->cache, &state, &nft-
> > >output.msgs);
> 
> Change signature to take struct nft_ctx as first parameter and get
> rid
> of everything but struct parser_state?

Fully agree with proposal.

> 
> >     scanner = scanner_init(&state);
> >     scanner_push_buffer(scanner, &indesc_cmdline, buf);
> >             
> > -   if (nft_run(nft, nft->nf_sock, &nft->cache, scanner,
> > &state, &msgs) != 0)
> > +   if (nft_run(nft, nft->nf_sock, &nft->cache, scanner,
> > +               &state, &nft->output.msgs) != 0)
> 
> Just use nft->output.msg directly in nft_run() and drop the
> parameter?

Yes, I think we can go and simplify a few functions prototype. I did
not do it cause of lack of time but also because I wanted to have
everybody agree on the data model before doing this changes.

++
-- 
Eric Leblond <e...@regit.org>
Blog: https://home.regit.org/
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to