summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/common/utils.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h2
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.h1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c2
-rw-r--r--src/mesa/main/hash_table.c3
-rw-r--r--src/mesa/main/macros.h3
-rw-r--r--src/mesa/main/set.c3
7 files changed, 7 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index 062712bf335..ac0773b0d4c 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
+#include "main/macros.h"
#include "main/mtypes.h"
#include "main/cpuinfo.h"
#include "main/extensions.h"
@@ -391,8 +392,6 @@ static const struct { unsigned int attrib, offset; } attribMap[] = {
__ATTRIB(__DRI_ATTRIB_SWAP_METHOD, level)
};
-#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-
/**
* Return the value of a configuration attribute. The attribute is
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index af49ab137c3..cae8ecf7a4f 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -348,8 +348,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 down to an alignment value
*
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h
index f135dead3ee..ce744bf1384 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.h
+++ b/src/mesa/drivers/dri/intel/intel_fbo.h
@@ -31,6 +31,7 @@
#include <stdbool.h>
#include <assert.h>
#include "main/formats.h"
+#include "main/macros.h"
#include "intel_context.h"
#include "intel_screen.h"
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 7d1c0be4365..ee77fc48134 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -701,8 +701,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/hash_table.c b/src/mesa/main/hash_table.c
index 2bd1929aa9d..af0510da105 100644
--- a/src/mesa/main/hash_table.c
+++ b/src/mesa/main/hash_table.c
@@ -44,10 +44,9 @@
#include <string.h>
#include "main/hash_table.h"
+#include "main/macros.h"
#include "ralloc.h"
-#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
-
static const uint32_t deleted_key_value;
/**
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index d1e81fe082c..f6d38fb6480 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -766,5 +766,8 @@ DIFFERENT_SIGNS(GLfloat x, GLfloat y)
#define ENUM_TO_DOUBLE(E) ((GLdouble)(GLint)(E))
#define ENUM_TO_BOOLEAN(E) ((E) ? GL_TRUE : GL_FALSE)
+/* Compute the size of an array */
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+
#endif
diff --git a/src/mesa/main/set.c b/src/mesa/main/set.c
index 736841fc9c0..2519b96947a 100644
--- a/src/mesa/main/set.c
+++ b/src/mesa/main/set.c
@@ -34,11 +34,10 @@
#include <stdlib.h>
+#include "macros.h"
#include "set.h"
#include "ralloc.h"
-#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
-
/*
* From Knuth -- a good choice for hash/rehash values is p, p-2 where
* p and p-2 are both prime. These tables are sized to have an extra 10%