diff options
author | Phil Sutter <phil@nwl.cc> | 2018-07-19 18:31:54 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2018-07-19 22:15:12 +0200 |
commit | 87b5b9e2240e7cd5487d160cc3e059c61622ce75 (patch) | |
tree | 490686a1485eed2d1a9b3a055a797f1983f97794 /iptables/xtables-arp.c | |
parent | 907da5c505b219537586f7c2bdb7320c4f97386f (diff) |
iptables: replace memset by c99-style initializers
This cleans up a few obvious cases identified by grepping the source
code for 'memset'.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/xtables-arp.c')
-rw-r--r-- | iptables/xtables-arp.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/iptables/xtables-arp.c b/iptables/xtables-arp.c index eb03beb7..ffe47786 100644 --- a/iptables/xtables-arp.c +++ b/iptables/xtables-arp.c @@ -588,16 +588,15 @@ static struct in_addr * host_to_addr(const char *name, unsigned int *naddr) { struct in_addr *addr; - struct addrinfo hints; + struct addrinfo hints = { + .ai_flags = AI_CANONNAME, + .ai_family = AF_INET, + .ai_socktype = SOCK_RAW, + };; struct addrinfo *res, *p; int err; unsigned int i; - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = AI_CANONNAME; - hints.ai_family = AF_INET; - hints.ai_socktype = SOCK_RAW; - *naddr = 0; err = getaddrinfo(name, NULL, &hints, &res); if (err != 0) @@ -932,7 +931,9 @@ delete_entry(const char *chain, int do_commandarp(struct nft_handle *h, int argc, char *argv[], char **table) { - struct arptables_command_state cs; + struct arptables_command_state cs = { + .jumpto = "", + }; int invert = 0; unsigned int nsaddrs = 0, ndaddrs = 0; struct in_addr *saddrs = NULL, *daddrs = NULL; @@ -946,9 +947,6 @@ int do_commandarp(struct nft_handle *h, int argc, char *argv[], char **table) int ret = 1; struct xtables_target *t; - memset(&cs, 0, sizeof(cs)); - cs.jumpto = ""; - opts = original_opts; global_option_offset = 0; |