From 4885331de84cbb895d31b83696a9b6d6542f2a81 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 10 Apr 2018 19:00:23 +0200 Subject: libnftables: Simplify cookie integration This increases the size of struct output_ctx quite a bit, but allows to simplify internal functions dealing with the cookies mainly because output_fp becomes accessible from struct cookie. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- include/nftables.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/nftables.h b/include/nftables.h index 5c181be5..75134def 100644 --- a/include/nftables.h +++ b/include/nftables.h @@ -8,10 +8,11 @@ #include struct cookie { + FILE *fp; + FILE *orig_fp; char *buf; size_t buflen; size_t pos; - FILE *orig_fp; }; struct output_ctx { @@ -20,10 +21,14 @@ struct output_ctx { unsigned int ip2name; unsigned int handle; unsigned int echo; - FILE *output_fp; - FILE *error_fp; - struct cookie *output_cookie; - struct cookie *error_cookie; + union { + FILE *output_fp; + struct cookie output_cookie; + }; + union { + FILE *error_fp; + struct cookie error_cookie; + }; }; struct nft_cache { -- cgit v1.2.3