Thread (11 messages) 11 messages, 3 authors, 2016-09-28

Local variable ordering (was Re: [PATCH v5 0/7] Reduce cache miss for snmp_fold_field)

From: Edward Cree <hidden>
Date: 2016-09-28 15:58:54
Also in: linux-sctp, lkml

On 28/09/16 14:45, hejianet wrote:

On 9/28/16 5:08 PM, David Miller wrote:
quoted
From: Jia He <redacted>
Date: Wed, 28 Sep 2016 14:22:21 +0800
quoted
v5:
- order local variables from longest to shortest line
I still see many cases where this problem still exists.  Please
do not resubmit this patch series until you fix all of them.

Patch #2:

-static int snmp_seq_show(struct seq_file *seq, void *v)
+static int snmp_seq_show_ipstats(struct seq_file *seq, void *v)
  {
      int i;
+    u64 buff64[IPSTATS_MIB_MAX];
      struct net *net = seq->private;

The order should be "net" then "buff64" then "i".
Sorry for my bad eyesight and quick hand :(
B.R.
Jia
A few months back I wrote a script to help find these:
https://github.com/ecree-solarflare/xmastree
It can check a source file or a patch.
Posting in the hope that people will find it useful.

-Ed
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help