Re: [PATCH nft 2/2] json: drop handling missing json() hook for "struct expr_ops"

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

 



On Thu, 2023-11-02 at 12:20 +0100, Thomas Haller wrote:
> 
>  
>  static json_t *stmt_print_json(const struct stmt *stmt, struct
> output_ctx *octx)
>  {
> -	char buf[1024];
> -	FILE *fp;
> -
> -	if (stmt->ops->json)
> -		return stmt->ops->json(stmt, octx);
> -
> -	fprintf(stderr, "warning: stmt ops %s have no json
> callback\n",
> -		stmt->ops->name);
> -
> -	fp = octx->output_fp;
> -	octx->output_fp = fmemopen(buf, 1024, "w");
> -
> -	stmt->ops->print(stmt, octx);
> -
> -	fclose(octx->output_fp);
> -	octx->output_fp = fp;
> -
> -	return json_pack("s", buf);
> +	return stmt->ops->json(stmt, octx);
>  }

Regardless the ongoing discussion...

This part of the patch is wrong. Must not be applied.


stmt->ops is a "struct stmt_ops", which still has NULL "json"
callbacks. The patch 1/1 only addresses "json" hooks in "struct
expr_ops".


Thomas





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux