summaryrefslogtreecommitdiff
path: root/damageext
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 /damageext
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 'damageext')
-rw-r--r--damageext/damageext.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/damageext/damageext.c b/damageext/damageext.c
index b186d2c40..ce490cbf2 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -464,8 +464,6 @@ static const int version_requests[] = {
X_DamageAdd, /* Version 1 */
};
-#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
-
static int (*ProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
/*************** Version 1 ******************/
ProcDamageQueryVersion,
@@ -482,7 +480,7 @@ ProcDamageDispatch(ClientPtr client)
REQUEST(xDamageReq);
DamageClientPtr pDamageClient = GetDamageClient(client);
- if (pDamageClient->major_version >= NUM_VERSION_REQUESTS)
+ if (pDamageClient->major_version >= ARRAY_SIZE(version_requests))
return BadRequest;
if (stuff->damageReqType > version_requests[pDamageClient->major_version])
return BadRequest;