Skip to contentSkip to conversation

trivial: use ARRAY_SIZE

PATCH Applied Kulikov Vasiliy 4 participants 4 messages Jun 28, 2010 – Jul 20, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/16 trivial: use ARRAY_SIZE

Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x).

---
 drivers/char/synclink_gt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/synclink_gt.c +1 -1
index 4561ce2..334cf5c 100644
@@ -4845,7 +4845,7 @@ static int register_test(struct slgt_info *info)
 {
 	static unsigned short patterns[]  		{0x0000, 0xffff, 0xaaaa, 0x5555, 0x6969, 0x9696};
-	static unsigned int count = sizeof(patterns)/sizeof(patterns[0]);
+	static unsigned int count = ARRAY_SIZE(patterns);
 	unsigned int i;
 	int rc = 0;
 
Signature · 1 line
1.7.0.4
Acked-by on v1 2/16
#1 lore raw
Quoted 12 lines · Kulikov Vasiliy

Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x).

---
 drivers/char/synclink_gt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/synclink_gt.c +0 -0
index 4561ce2..334cf5c 100644

drivers/char/synclink_gt.c static int register_test(struct slgt_info *info) · line 4850

Quoted 7 lines
drivers/char/synclink_gt.c +1 -1
@@ -4845,7 +4845,7 @@ static int register_test(struct slgt_info *info)
 {
 	static unsigned short patterns[] >  		{0x0000, 0xffff, 0xaaaa, 0x5555, 0x6969, 0x9696};
-	static unsigned int count = sizeof(patterns)/sizeof(patterns[0]);
+	static unsigned int count = ARRAY_SIZE(patterns);
 	unsigned int i;
 	int rc = 0;
 

with the exception of the trailing CR :-)

Signature · 2 lines
Paul Fulghum
MicroGate Systems, Ltd.
#2 lore raw
Quoted 7 lines · Paul Fulghum
Quoted 7 lines

Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x).

---
 drivers/char/synclink_gt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 14 lines

drivers/char/synclink_gt.c static int register_test(struct slgt_info *info) · line 4850

Quoted 12 lines
drivers/char/synclink_gt.c +1 -1
index 4561ce2..334cf5c 100644
@@ -4845,7 +4845,7 @@ static int register_test(struct slgt_info *info)
 {
 	static unsigned short patterns[] > >  		{0x0000, 0xffff, 0xaaaa, 0x5555, 0x6969, 0x9696};
-	static unsigned int count = sizeof(patterns)/sizeof(patterns[0]);
+	static unsigned int count = ARRAY_SIZE(patterns);
 	unsigned int i;
 	int rc = 0;
 

The patch is not in linux-next as of today. Applied, thanks guys.

Signature · 2 lines
Jiri Kosina
SUSE Labs, Novell Inc.