[PATCH 02/42] Add a common ARRAY_SIZE macro to dix.h

Daniel Stone daniel at fooishbar.org
Fri Dec 2 03:27:10 PST 2011


Does what it says on the box, replacing those from Xi/ and glx/.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
Reviewed-by: Cyril Brulebois <kibi at debian.org>
Reviewed-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xi/extinit.c       |    2 --
 glx/glxdricommon.c |    2 --
 include/dix.h      |    2 ++
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/Xi/extinit.c b/Xi/extinit.c
index a2c807b..d233067 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -49,8 +49,6 @@ SOFTWARE.
  *  Dispatch routines and initialization routines for the X input extension.
  *
  */
-#define ARRAY_SIZE(_a)        (sizeof((_a)) / sizeof((_a)[0]))
-
 #define	 NUMTYPES 15
 
 #ifdef HAVE_DIX_CONFIG_H
diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c
index 9149e0d..0e977e4 100644
--- a/glx/glxdricommon.c
+++ b/glx/glxdricommon.c
@@ -105,8 +105,6 @@ static const struct { unsigned int attrib, offset; } attribMap[] = {
     __ATTRIB(__DRI_ATTRIB_YINVERTED,			yInverted),
 };
 
-#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-
 static void
 setScalar(__GLXconfig *config, unsigned int attrib, unsigned int value)
 {
diff --git a/include/dix.h b/include/dix.h
index 34661f3..1c1fb96 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -65,6 +65,8 @@ SOFTWARE.
 #define REQUEST(type) \
 	type *stuff = (type *)client->requestBuffer
 
+#define ARRAY_SIZE(a)  (sizeof((a)) / sizeof((a)[0]))
+
 
 #define REQUEST_SIZE_MATCH(req)\
     if ((sizeof(req) >> 2) != client->req_len)\
-- 
1.7.7.3



More information about the xorg-devel mailing list