Skip to contentSkip to conversation

trivial: use ARRAY_SIZE

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

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

PATCH 8/16 trivial: use ARRAY_SIZE

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

---
 drivers/scsi/libfc/fc_exch.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/scsi/libfc/fc_exch.c +1 -3
index 104e0fb..ca52bfa 100644
@@ -219,8 +219,6 @@ static void fc_exch_els_rrq(struct fc_seq *, struct fc_frame *);
  */
 static char *fc_exch_rctl_names[] = FC_RCTL_NAMES_INIT;
 
-#define FC_TABLE_SIZE(x)   (sizeof(x) / sizeof(x[0]))
-
 /**
  * fc_exch_name_lookup() - Lookup name by opcode
  * @op:	       Opcode to be looked up
@@ -249,7 +247,7 @@ static inline const char *fc_exch_name_lookup(unsigned int op, char **table,
 static const char *fc_exch_rctl_name(unsigned int op)
 {
 	return fc_exch_name_lookup(op, fc_exch_rctl_names,
-				   FC_TABLE_SIZE(fc_exch_rctl_names));
+				   ARRAY_SIZE(fc_exch_rctl_names));
 }
 
 /**
Signature · 1 line
1.7.0.4
Applied
#1 lore raw
Quoted 21 lines · Kulikov Vasiliy

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

---
 drivers/scsi/libfc/fc_exch.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/scsi/libfc/fc_exch.c +0 -2
index 104e0fb..ca52bfa 100644
@@ -219,8 +219,6 @@ static void fc_exch_els_rrq(struct fc_seq *, struct fc_frame *);
  */
 static char *fc_exch_rctl_names[] = FC_RCTL_NAMES_INIT;
 
-#define FC_TABLE_SIZE(x)   (sizeof(x) / sizeof(x[0]))
-
 /**
  * fc_exch_name_lookup() - Lookup name by opcode
  * @op:	       Opcode to be looked up

drivers/scsi/libfc/fc_exch.c static inline const char *fc_exch_name_lookup(unsigned int op, char **table, · line 251

Quoted 6 lines
drivers/scsi/libfc/fc_exch.c +1 -1
@@ -249,7 +247,7 @@ static inline const char *fc_exch_name_lookup(unsigned int op, char **table,
 static const char *fc_exch_rctl_name(unsigned int op)
 {
 	return fc_exch_name_lookup(op, fc_exch_rctl_names,
-				   FC_TABLE_SIZE(fc_exch_rctl_names));
+				   ARRAY_SIZE(fc_exch_rctl_names));
 }

Applied. Please use better Subject: lines next time though. Having the whole series have the same Subject: line doesn't really help.

Thanks,

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