]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
rule: Use C99-style initializer in cache_init()
authorPhil Sutter <phil@nwl.cc>
Thu, 28 Sep 2017 15:17:41 +0000 (17:17 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 29 Sep 2017 10:37:44 +0000 (12:37 +0200)
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/rule.c

index 30d3693afa5479dca020feb21eb505a7a536f38c..b122f020f4fcf4df3b66bc3911a35610a5413642 100644 (file)
@@ -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;