From: akpm@linux-foundation.org
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, akpm@linux-foundation.org, julia@diku.dk,
per.liden@nospam.ericsson.com
Subject: [patch 1/2] net/tipc/bcast.h: use ARRAY_SIZE
Date: Fri, 09 Jan 2009 12:22:21 -0800 [thread overview]
Message-ID: <200901092022.n09KMLkf019501@imap1.linux-foundation.org> (raw)
From: Julia Lawall <julia@diku.dk>
ARRAY_SIZE is more concise to use when the size of an array is divided by
the size of its type or the size of its first element.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@i@
@@
#include <linux/kernel.h>
@depends on i using "paren.iso"@
type T;
T[] E;
@@
- (sizeof(E)/sizeof(T))
+ ARRAY_SIZE(E)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Per Liden <per.liden@nospam.ericsson.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
net/tipc/bcast.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -puN net/tipc/bcast.h~net-tipc-bcasth-use-array_size net/tipc/bcast.h
--- a/net/tipc/bcast.h~net-tipc-bcasth-use-array_size
+++ a/net/tipc/bcast.h
@@ -124,7 +124,7 @@ static inline int tipc_nmap_equal(struct
static inline void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b,
struct tipc_node_map *nm_diff)
{
- int stop = sizeof(nm_a->map) / sizeof(u32);
+ int stop = ARRAY_SIZE(nm_a->map);
int w;
int b;
u32 map;
_
next reply other threads:[~2009-01-09 20:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-09 20:22 akpm [this message]
2009-01-10 7:09 ` [patch 1/2] net/tipc/bcast.h: use ARRAY_SIZE David 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=200901092022.n09KMLkf019501@imap1.linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=julia@diku.dk \
--cc=netdev@vger.kernel.org \
--cc=per.liden@nospam.ericsson.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).