Use ARRAY_SIZE all over the tree

Roundhouse kick replacing the various (sizeof(foo)/sizeof(foo[0])) with
the ARRAY_SIZE macro from dix.h when possible. A semantic patch for
coccinelle has been used first. Additionally, a few macros have been
inlined as they had only one or two users.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Daniel Martin
2017-10-27 16:11:56 +02:00
committed by Adam Jackson
parent 15a32ee5d1
commit d5379b350f
44 changed files with 66 additions and 105 deletions

View File

@@ -1427,7 +1427,7 @@ include_bit_test_macros(void)
uint8_t mask[9] = { 0 };
int i;
for (i = 0; i < sizeof(mask) / sizeof(mask[0]); i++) {
for (i = 0; i < ARRAY_SIZE(mask); i++) {
assert(BitIsOn(mask, i) == 0);
SetBit(mask, i);
assert(BitIsOn(mask, i) == 1);