util: use cannonical form of ARRAY_SIZE
authorEmil Velikov <emil.velikov@collabora.com>
Mon, 31 Jul 2017 18:45:48 +0000 (19:45 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 2 Aug 2017 19:43:33 +0000 (20:43 +0100)
Namely sizeof(foo)/sizeof((foo)[0])

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
src/util/macros.h

index a66f1bfed072b843bc01e94be0a13285d02edad3..a9a52a1a47821f269f2773d2312dde730ff6d483 100644 (file)
@@ -30,7 +30,7 @@
 
 /* Compute the size of an array */
 #ifndef ARRAY_SIZE
-#  define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
+#  define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 #endif
 
 /* For compatibility with Clang's __has_builtin() */