Mesa (master): util: use cannonical form of ARRAY_SIZE

Emil Velikov evelikov at kemper.freedesktop.org
Wed Aug 2 19:47:57 UTC 2017


Module: Mesa
Branch: master
Commit: c9ec28b1c09be3d60520bf96dec8445d60bd75af
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9ec28b1c09be3d60520bf96dec8445d60bd75af

Author: Emil Velikov <emil.velikov at collabora.com>
Date:   Mon Jul 31 19:45:48 2017 +0100

util: use cannonical form of ARRAY_SIZE

Namely sizeof(foo)/sizeof((foo)[0])

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

---

 src/util/macros.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/macros.h b/src/util/macros.h
index a66f1bfed0..a9a52a1a47 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -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() */




More information about the mesa-commit mailing list