summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2017-09-28 17:17:41 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2017-09-29 12:37:44 +0200
commit8254efdc504f202eab7be64f06bf011b02d9693a (patch)
tree01789c62124c855a68d2e6a7cc71d386af7eb514 /src
parent50537e9e67622acff7d40e495f8d106162f3e38e (diff)
rule: Use C99-style initializer in cache_init()
Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/rule.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/rule.c b/src/rule.c
index 30d3693a..b122f020 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -128,17 +128,16 @@ static int cache_init(struct mnl_socket *nf_sock, struct nft_cache *cache,
struct handle handle = {
.family = NFPROTO_UNSPEC,
};
- struct netlink_ctx ctx;
+ struct netlink_ctx ctx = {
+ .list = LIST_HEAD_INIT(ctx.list),
+ .nf_sock = nf_sock,
+ .cache = cache,
+ .msgs = msgs,
+ .seqnum = cache->seqnum++,
+ .debug_mask = debug_mask,
+ };
int ret;
- memset(&ctx, 0, sizeof(ctx));
- init_list_head(&ctx.list);
- ctx.nf_sock = nf_sock;
- ctx.cache = cache;
- ctx.msgs = msgs;
- ctx.seqnum = cache->seqnum++;
- ctx.debug_mask = debug_mask;
-
ret = cache_init_tables(&ctx, &handle, cache);
if (ret < 0)
return ret;