Re: [PATCH nft,v3 2/5] src: add nft_ctx_output_{get,set}_stateless() to nft_ctx_output_{get,flags}_flags

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

 



Hi,

On Mon, Oct 29, 2018 at 01:31:00PM +0100, Pablo Neira Ayuso wrote:
[...]
> @@ -1354,10 +1354,11 @@ json_t *objref_stmt_json(const struct stmt *stmt, struct output_ctx *octx)
>  json_t *meter_stmt_json(const struct stmt *stmt, struct output_ctx *octx)
>  {
>  	json_t *root, *tmp;
> +	unsigned int flags;
>  
> -	octx->stateless++;
> +	nft_output_save_flags(octx, &flags, NFT_CTX_OUTPUT_STATELESS);
>  	tmp = stmt_print_json(stmt->meter.stmt, octx);
> -	octx->stateless--;
> +	nft_output_restore_flags(octx, flags);
>  
>  	root = json_pack("{s:o, s:o, s:i}",
>  			 "key", expr_print_json(stmt->meter.key, octx),

No objections, though I don't think this is any more clear than:

|  json_t *meter_stmt_json(const struct stmt *stmt, struct output_ctx *octx)
|  {
|  	json_t *root, *tmp;
| +	unsigned int flags = octx->flags;
|  
| -	octx->stateless++;
| +	octx->flags |= NFT_CTX_OUTPUT_STATELESS;
|  	tmp = stmt_print_json(stmt->meter.stmt, octx);
| -	octx->stateless--;
| +	octx->flags = flags;

Cheers, Phil



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

  Powered by Linux