[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CBD1126@AcuExch.aculab.com>
Date: Fri, 13 Nov 2015 17:30:10 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Phil Sutter' <phil@....cc>,
Stephen Hemminger <shemming@...cade.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [iproute PATCH 05/12] ip{,6}tunnel: align do_tunnels_list() a
bit
From: Phil Sutter
> Sent: 13 November 2015 17:09
> In iptunnel, declare loop variables inside the loop as done in
> ip6tunnel.
...
> @@ -396,14 +396,8 @@ static void print_tunnel(struct ip_tunnel_parm *p)
>
> static int do_tunnels_list(struct ip_tunnel_parm *p)
> {
> - char name[IFNAMSIZ];
> - unsigned long rx_bytes, rx_packets, rx_errs, rx_drops,
> - rx_fifo, rx_frame,
> - tx_bytes, tx_packets, tx_errs, tx_drops,
> - tx_fifo, tx_colls, tx_carrier, rx_multi;
> - struct ip_tunnel_parm p1;
> -
...
> while (fgets(buf, sizeof(buf), fp) != NULL) {
> + char name[IFNAMSIZ];
> int index, type;
> + unsigned long rx_bytes, rx_packets, rx_errs, rx_drops,
> + rx_fifo, rx_frame,
> + tx_bytes, tx_packets, tx_errs, tx_drops,
> + tx_fifo, tx_colls, tx_carrier, rx_multi;
> + struct ip_tunnel_parm p1;
> char *ptr;
> +
Personally I find that just makes it harder to find where the
variables are defined.
Since the linux kernel cannot be compiled with -Wshadow declaring
variables in inner scopes can easily lead to very strange bugs.
David
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists