x86: Use ARRAY_SIZE
Using the ARRAY_SIZE macro improves the readability of the code. Found with Coccinelle with the following semantic patch: @r depends on (org || report)@ type T; T[] E; position p; @@ ( (sizeof(E)@p /sizeof(*E)) | (sizeof(E)@p /sizeof(E[...])) | (sizeof(E)@p /sizeof(T)) ) Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: linux-video@atrey.karlin.mff.cuni.cz Cc: Martin Mares <mj@ucw.cz> Cc: Andy Lutomirski <luto@amacapital.net> Link: https://lkml.kernel.org/r/20171001193101.8898-13-jeremy.lefaure@lse.epita.fr
This commit is contained in:

gecommit door
Thomas Gleixner

bovenliggende
33d930e59a
commit
0cfe5b5fc0
@@ -65,6 +65,7 @@
|
||||
|
||||
#include <linux/elf.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
const char *outfilename;
|
||||
|
||||
@@ -151,7 +152,7 @@ extern void bad_put_le(void);
|
||||
PLE(x, val, 64, PLE(x, val, 32, PLE(x, val, 16, LAST_PLE(x, val))))
|
||||
|
||||
|
||||
#define NSYMS (sizeof(required_syms) / sizeof(required_syms[0]))
|
||||
#define NSYMS ARRAY_SIZE(required_syms)
|
||||
|
||||
#define BITSFUNC3(name, bits, suffix) name##bits##suffix
|
||||
#define BITSFUNC2(name, bits, suffix) BITSFUNC3(name, bits, suffix)
|
||||
|
Verwijs in nieuw issue
Block a user