Re: [libnftables PATCH 4/6] internal: add a selector for parsing ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 07, 2014 at 12:47:32PM +0100, Arturo Borrero Gonzalez wrote:
> This patch adds a selector for parsing operations.
> 
> The selector allows to reduce code duplication in case more than
> one parsing interface are used.

This needs a rework.

> Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@xxxxxxxxx>
> ---
>  0 files changed
> 
> diff --git a/src/chain.c b/src/chain.c
> index a4ddb06..fd56629 100644
> --- a/src/chain.c
> +++ b/src/chain.c
> @@ -592,13 +592,14 @@ err:
>  #endif
>  
>  static int nft_chain_json_parse(struct nft_chain *c, const char *json,
> -				struct nft_parse_err *err)
> +				struct nft_parse_err *err,
> +				const struct nft_parse_ops *ops)

You should pass a callback function instead, eg.

static int nft_chain_json_parse(struct nft_chain *c, const char *json,
				struct nft_parse_err *err,
                                json_t *(*jsonbuilder)(const void *input_data,
                                                       const char *treename,
                                                       struct nft_parse_err *e))
But I don't understand yet what you save (in terms of lines of code)
by using this aproach.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux