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 --- Xi/xiproperty.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Xi') diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index 9acb2ebe3..6ec419e87 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -372,8 +372,7 @@ XIGetKnownProperty(const char *name) if (!name) return None; - for (i = 0; i < (sizeof(dev_properties) / sizeof(struct dev_properties)); - i++) { + for (i = 0; i < ARRAY_SIZE(dev_properties); i++) { if (strcmp(name, dev_properties[i].name) == 0) { if (dev_properties[i].type == None) { dev_properties[i].type = @@ -393,8 +392,7 @@ XIResetProperties(void) { int i; - for (i = 0; i < (sizeof(dev_properties) / sizeof(struct dev_properties)); - i++) + for (i = 0; i < ARRAY_SIZE(dev_properties); i++) dev_properties[i].type = None; } -- cgit v1.2.3