summaryrefslogtreecommitdiff
path: root/composite/compinit.c
diff options
context:
space:
mode:
authorDaniel Martin <consume.noise@gmail.com>2017-10-27 16:11:56 +0200
committerAdam Jackson <ajax@redhat.com>2017-10-30 13:45:20 -0400
commitd5379b350fb63e42e604361c21ad9832b4c791b9 (patch)
tree9ff0602258e2d4afb74561614810fb8a8e0e1860 /composite/compinit.c
parent15a32ee5d1fffa171bb05af9a0e5b472e4af1488 (diff)
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>
Diffstat (limited to 'composite/compinit.c')
-rw-r--r--composite/compinit.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/composite/compinit.c b/composite/compinit.c
index 791fec922..2590aa46d 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -284,9 +284,6 @@ static CompAlternateVisual altVisuals[] = {
{32, PICT_a8r8g8b8},
};
-static const int NUM_COMP_ALTERNATE_VISUALS = sizeof(altVisuals) /
- sizeof(CompAlternateVisual);
-
static Bool
compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
CompAlternateVisual * alt)
@@ -362,7 +359,7 @@ compAddAlternateVisuals(ScreenPtr pScreen, CompScreenPtr cs)
{
int alt, ret = 0;
- for (alt = 0; alt < NUM_COMP_ALTERNATE_VISUALS; alt++)
+ for (alt = 0; alt < ARRAY_SIZE(altVisuals); alt++)
ret |= compAddAlternateVisual(pScreen, cs, altVisuals + alt);
return ! !ret;