diff options
author | Pauli Nieminen <pauli.nieminen@linux.intel.com> | 2012-06-08 23:29:59 +0300 |
---|---|---|
committer | Pauli Nieminen <pauli.nieminen@linux.intel.com> | 2012-06-10 00:26:25 +0300 |
commit | 343409eddc2659e09eb039b2516bf58651a0fbeb (patch) | |
tree | 47fddf3b6277364f67fef5f94bbcb212fe3e51da | |
parent | d8e8f9df49b92d041ac2d0d8382764d0956be7e5 (diff) |
mesa/macros: Add ARRAY_SIZE helper macro core mesa
The ARRAY_SIZE macro is usefull helper that is used already in many
parts of core. But mesa core was missing it. I decided to add it to the
macros.h when I wanted to use it in following patch.
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_context.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_screen.c | 2 | ||||
-rw-r--r-- | src/mesa/main/macros.h | 3 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index cc3ee0d359..4dc98d6b21 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -33,6 +33,7 @@ #include <string.h> #include "main/mtypes.h" #include "main/mm.h" +#include "main/macros.h" #ifdef __cplusplus extern "C" { @@ -341,8 +342,6 @@ extern char *__progname; #define SUBPIXEL_X 0.125 #define SUBPIXEL_Y 0.125 -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) - /** * Align a value up to an alignment value * diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 85cfe17ad7..b0545b5986 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -702,8 +702,6 @@ radeonDestroyBuffer(__DRIdrawable *driDrawPriv) _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } -#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) - /** * This is the driver specific part of the createNewScreen entry point. * Called when using DRI2. diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index d1df2ce1b0..e05fa14b46 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -679,5 +679,8 @@ do { \ #define ENUM_TO_DOUBLE(E) ((GLdouble)(GLint)(E)) #define ENUM_TO_BOOLEAN(E) ((E) ? GL_TRUE : GL_FALSE) +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#endif #endif |