[PATCH 06/54] Add a common ARRAY_SIZE macro to dix.h

Daniel Stone daniel at fooishbar.org
Mon Jul 9 18:02:50 PDT 2012


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 94f46f7..186a29d 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 44d5a3e..c90f380 100644
--- a/glx/glxdricommon.c
+++ b/glx/glxdricommon.c
@@ -107,8 +107,6 @@ __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
         __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture),
         __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 3d8b0e5..5773fc7 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -64,6 +64,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)\
          return(BadLength)
-- 
1.7.10.4



More information about the xorg-devel mailing list