From eb5e1230386ce2eafa2ef1770bb5ffd3e918fdc6 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 28 Sep 2022 14:33:19 +1000 Subject: cppcheck: Reduce scope of some variables Minor style improvement suggested by cppcheck. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- netlink.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'netlink.c') diff --git a/netlink.c b/netlink.c index 8ad6a0c..6f7ada8 100644 --- a/netlink.c +++ b/netlink.c @@ -147,7 +147,6 @@ unsigned int nl_get_ext_if(sa_family_t af) }; struct nlmsghdr *nh; struct rtattr *rta; - struct rtmsg *rtm; char buf[BUFSIZ]; ssize_t n; size_t na; @@ -158,7 +157,7 @@ unsigned int nl_get_ext_if(sa_family_t af) nh = (struct nlmsghdr *)buf; for ( ; NLMSG_OK(nh, n); nh = NLMSG_NEXT(nh, n)) { - rtm = (struct rtmsg *)NLMSG_DATA(nh); + struct rtmsg *rtm = (struct rtmsg *)NLMSG_DATA(nh); if (rtm->rtm_dst_len || rtm->rtm_family != af) continue; -- cgit v1.2.3