* [janitor] get_stats: collapse conditionals
@ 2004-01-25 6:19 Randy.Dunlap
2004-01-25 19:10 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: Randy.Dunlap @ 2004-01-25 6:19 UTC (permalink / raw)
To: netdev; +Cc: davem
Hi,
Please apply to 2.6.current.
Thanks,
--
~Randy
From: Domen Puncer <domen@coderock.org>
Hi.
Get rid of one comparison, improve readability.
diff -puN net/core/dev.c~netdev_get_stats net/core/dev.c
linux-262-rc1-bk1-rddunlap/net/core/dev.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff -puN net/core/dev.c~netdev_get_stats net/core/dev.c
--- linux-262-rc1-bk1/net/core/dev.c~netdev_get_stats 2004-01-23 15:52:33.000000000 -0800
+++ linux-262-rc1-bk1-rddunlap/net/core/dev.c 2004-01-23 15:52:33.000000000 -0800
@@ -1940,9 +1940,9 @@ void dev_seq_stop(struct seq_file *seq,
static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
{
- struct net_device_stats *stats = dev->get_stats ? dev->get_stats(dev) :
- NULL;
- if (stats)
+ if (dev->get_stats) {
+ struct net_device_stats *stats = dev->get_stats(dev);
+
seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
"%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
dev->name, stats->rx_bytes, stats->rx_packets,
@@ -1960,6 +1960,7 @@ static void dev_seq_printf_stats(struct
stats->tx_window_errors +
stats->tx_heartbeat_errors,
stats->tx_compressed);
+ }
else
seq_printf(seq, "%6s: No statistics available.\n", dev->name);
}
_
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [janitor] get_stats: collapse conditionals
2004-01-25 6:19 [janitor] get_stats: collapse conditionals Randy.Dunlap
@ 2004-01-25 19:10 ` David S. Miller
0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2004-01-25 19:10 UTC (permalink / raw)
To: rddunlap; +Cc: netdev
From: "Randy.Dunlap" <rddunlap@osdl.org>
Date: Sat, 24 Jan 2004 22:19:28 -0800
Please apply to 2.6.current.
...
From: Domen Puncer <domen@coderock.org>
Applied, although I changed
}
else
to
} else
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-01-25 19:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-25 6:19 [janitor] get_stats: collapse conditionals Randy.Dunlap
2004-01-25 19:10 ` David S. Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.