summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-07-10 10:45:18 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2023-07-10 18:21:19 +0200
commit0c5c12f410d70c764ed0c333bf638665aca53d1c (patch)
tree9c82441edfc5ce9ae0eeeeffbcfca6a184c837e6 /src
parent1b25d18019260527f1e2fa259aa9bb51ad1a1ef0 (diff)
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 <thaller@redhat.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/libnftables.c7
1 files changed, 1 insertions, 6 deletions
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;
}