netfilter: ipset: ip_set_bitmap_ip: use swap macro in bitmap_ip_create
Subsystems (3)
PATCH 1/1 netfilter: ipset: ip_set_bitmap_ip: use swap macro in bitmap_ip_create
Make use of the swap macro and remove unnecessary variable 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 <[email protected]>
--- net/netfilter/ipset/ip_set_bitmap_ip.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
net/netfilter/ipset/ip_set_bitmap_ip.c +2 -6
@@ -263,12 +263,8 @@ bitmap_ip_create(struct net *net, struct ip_set *set, struct nlattr *tb[], ret =ip_set_get_hostipaddr4 (tb[IPSET_ATTR_IP_TO ], &last_ip);if (ret)return ret; -if (first_ip > last_ip) { -u32 tmp = first_ip; - - first_ip = last_ip; - last_ip = tmp; - } +if (first_ip > last_ip) +swap (first_ip, last_ip); }else if (tb[IPSET_ATTR_CIDR ]) {u8 cidr =nla_get_u8 (tb[IPSET_ATTR_CIDR ]);
Signature · 1 line
2.7.4