mirror of
https://github.com/openvswitch/ovs
synced 2025-10-27 15:18:06 +00:00
Avoid shadowing local variable names.
All of these changes avoid using the same name for two local variables within a same function. None of them are actual bugs as far as I can tell, but any of them could be confusing to the casual reader. The one in lib/ovsdb-idl.c is particularly brilliant: inner and outer loops both using (different) variables named 'i'. Found with GCC -Wshadow.
This commit is contained in:
@@ -1779,12 +1779,12 @@ netdev_linux_get_in6(const struct netdev *netdev_, struct in6_addr *in6)
|
||||
if (file != NULL) {
|
||||
const char *name = netdev_get_name(netdev_);
|
||||
while (fgets(line, sizeof line, file)) {
|
||||
struct in6_addr in6;
|
||||
struct in6_addr in6_tmp;
|
||||
char ifname[16 + 1];
|
||||
if (parse_if_inet6_line(line, &in6, ifname)
|
||||
if (parse_if_inet6_line(line, &in6_tmp, ifname)
|
||||
&& !strcmp(name, ifname))
|
||||
{
|
||||
netdev_dev->in6 = in6;
|
||||
netdev_dev->in6 = in6_tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user