diff options
author | Gustavo A. R. Silva <garsilva@embeddedor.com> | 2017-10-30 17:19:25 -0500 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-01-08 18:11:11 +0100 |
commit | c0453377518d8dd30dcc07b5bdd9e29512ca9aca (patch) | |
tree | 1b5a4caa0e6b7cd172d40e8030535a0b91fec2b4 /net/netfilter/ipset/ip_set_bitmap_port.c | |
parent | netfilter: nf_tables: flow offload expression (diff) | |
download | linux-dev-c0453377518d8dd30dcc07b5bdd9e29512ca9aca.tar.xz linux-dev-c0453377518d8dd30dcc07b5bdd9e29512ca9aca.zip |
netfilter: ipset: use swap macro instead of _manually_ swapping values
Make use of the swap macro and remove unnecessary variables tmp.
This makes the code easier to read and maintain.
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/ipset/ip_set_bitmap_port.c')
-rw-r--r-- | net/netfilter/ipset/ip_set_bitmap_port.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/net/netfilter/ipset/ip_set_bitmap_port.c b/net/netfilter/ipset/ip_set_bitmap_port.c index 7f9bbd7c98b5..b561ca8b3659 100644 --- a/net/netfilter/ipset/ip_set_bitmap_port.c +++ b/net/netfilter/ipset/ip_set_bitmap_port.c @@ -238,12 +238,8 @@ bitmap_port_create(struct net *net, struct ip_set *set, struct nlattr *tb[], first_port = ip_set_get_h16(tb[IPSET_ATTR_PORT]); last_port = ip_set_get_h16(tb[IPSET_ATTR_PORT_TO]); - if (first_port > last_port) { - u16 tmp = first_port; - - first_port = last_port; - last_port = tmp; - } + if (first_port > last_port) + swap(first_port, last_port); elements = last_port - first_port + 1; set->dsize = ip_set_elem_len(set, tb, 0, 0); |