From d5379b350fb63e42e604361c21ad9832b4c791b9 Mon Sep 17 00:00:00 2001 From: Daniel Martin Date: Fri, 27 Oct 2017 16:11:56 +0200 Subject: 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 Reviewed-by: Adam Jackson --- hw/kdrive/src/kdrive.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'hw/kdrive') diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 30e0ced70..82dcf4ae7 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -66,8 +66,6 @@ KdDepths kdDepths[] = { {32, 32} }; -#define NUM_KD_DEPTHS (sizeof (kdDepths) / sizeof (kdDepths[0])) - #define KD_DEFAULT_BUTTONS 5 DevPrivateKeyRec kdScreenPrivateKeyRec; @@ -886,7 +884,7 @@ KdSetPixmapFormats(ScreenInfo * pScreenInfo) /* * Fill in additional formats */ - for (i = 0; i < NUM_KD_DEPTHS; i++) + for (i = 0; i < ARRAY_SIZE(kdDepths); i++) if (!depthToBpp[kdDepths[i].depth]) depthToBpp[kdDepths[i].depth] = kdDepths[i].bpp; -- cgit v1.2.3