Skip to content

Commit

Permalink
Staging: speakup: Use ARRAY_SIZE macro
Browse files Browse the repository at this point in the history
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.

Changes made using Coccinelle-

@@
type T;
T[] E;
@@

- (sizeof(E)/sizeof(T))
+ ARRAY_SIZE(E)

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Shraddha Barke authored and Greg Kroah-Hartman committed Oct 8, 2015
1 parent f34b77e commit f60c265
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/speakup/i18n.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ static struct msg_group_t all_groups[] = {
},
};

static const int num_groups = sizeof(all_groups) / sizeof(struct msg_group_t);
static const int num_groups = ARRAY_SIZE(all_groups);

char *spk_msg_get(enum msg_index_t index)
{
Expand Down

0 comments on commit f60c265

Please sign in to comment.