plugins: netlink: minor refactor, collapse for-loop
@@ -131,8 +131,10 @@ static void nl_link(struct nlmsghdr *nlmsg, ssize_t len)
return;
}
- while (RTA_OK(a, la)) {
- if (a->rta_type == IFLA_IFNAME) {
+ for (; RTA_OK(a, la); a = RTA_NEXT(a, la)) {
+ if (a->rta_type != IFLA_IFNAME)
+ continue;
+
strlcpy(ifname, RTA_DATA(a), sizeof(ifname));
switch (nlmsg->nlmsg_type) {
case RTM_NEWLINK:
@@ -167,9 +169,6 @@ static void nl_link(struct nlmsghdr *nlmsg, ssize_t len)
break;
}
}
-
- a = RTA_NEXT(a, la);
- }
}
static void nl_callback(void *arg, int sd, int events)
