[PATCH 01/37] Add a common ARRAY_SIZE macro to dix.h

Daniel Stone daniel at fooishbar.org
Tue Jun 28 12:27:17 PDT 2011


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

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 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 0905e18..1e30b3c 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 b1bf9ed..cb47d23 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.5.4



More information about the xorg-devel mailing list