From: Thomas Haller Date: Mon, 10 Jul 2023 08:45:18 +0000 (+0200) Subject: libnftables: inline creation of nf_sock in nft_ctx_new() X-Git-Tag: v1.0.8~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0c5c12f410d70c764ed0c333bf638665aca53d1c;p=thirdparty%2Fnftables.git libnftables: inline creation of nf_sock in nft_ctx_new() The function only has one caller. It's not clear how to extend this in a useful way, so that it makes sense to keep the initialization in a separate function. Simplify the code, by inlining and dropping the static function nft_ctx_netlink_init(). There was only one caller. Signed-off-by: Thomas Haller Signed-off-by: Pablo Neira Ayuso --- diff --git a/src/libnftables.c b/src/libnftables.c index 5b3eb2dc..79dfdfc7 100644 --- a/src/libnftables.c +++ b/src/libnftables.c @@ -186,11 +186,6 @@ void nft_ctx_clear_include_paths(struct nft_ctx *ctx) ctx->include_paths = NULL; } -static void nft_ctx_netlink_init(struct nft_ctx *ctx) -{ - ctx->nf_sock = nft_mnl_socket_open(); -} - EXPORT_SYMBOL(nft_ctx_new); struct nft_ctx *nft_ctx_new(uint32_t flags) { @@ -218,7 +213,7 @@ struct nft_ctx *nft_ctx_new(uint32_t flags) ctx->output.error_fp = stderr; init_list_head(&ctx->vars_ctx.indesc_list); - nft_ctx_netlink_init(ctx); + ctx->nf_sock = nft_mnl_socket_open(); return ctx; }