netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: netdev@oss.sgi.com
Cc: davem@redhat.com
Subject: [janitor] get_stats: collapse conditionals
Date: Sat, 24 Jan 2004 22:19:28 -0800	[thread overview]
Message-ID: <20040124221928.16f4c708.rddunlap@osdl.org> (raw)


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);
 }

_

             reply	other threads:[~2004-01-25  6:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-25  6:19 Randy.Dunlap [this message]
2004-01-25 19:10 ` [janitor] get_stats: collapse conditionals David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040124221928.16f4c708.rddunlap@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=davem@redhat.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).