summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/macros.h')
-rw-r--r--src/mesa/main/macros.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index e47b85ff8bc..9af40398d07 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -1,4 +1,4 @@
-/* $Id: macros.h,v 1.2 1999/10/08 09:27:11 keithw Exp $ */
+/* $Id: macros.h,v 1.3 1999/10/10 12:39:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -480,6 +480,28 @@ do { \
+/*
+ * Memory allocation
+ * XXX these should probably go into a new glmemory.h file.
+ */
+#ifdef DEBUG
+extern void *gl_alloc(size_t bytes);
+extern void *gl_calloc(size_t bytes);
+extern void gl_free(void *ptr);
+#define GL_ALLOC(BYTES) gl_alloc(BYTES)
+#define GL_CALLOC(BYTES) gl_calloc(BYTES)
+#define GL_ALLOC_STRUCT(T) (struct T *) GL_ALLOC(sizeof(struct T))
+#define GL_CALLOC_STRUCT(T) (struct T *) GL_CALLOC(sizeof(struct T))
+#define GL_FREE(PTR) gl_free(PTR)
+#else
+#define GL_ALLOC(BYTES) (void *) malloc(BYTES)
+#define GL_CALLOC(BYTES) (void *) calloc(1, BYTES)
+#define GL_ALLOC_STRUCT(T) (struct T *) malloc(sizeof(struct T))
+#define GL_CALLOC_STRUCT(T) (struct T *) calloc(sizeof(struct T))
+#define GL_FREE(PTR) free(PTR)
+#endif
+
+
/* Memory copy: */
#ifdef SUNOS4
#define MEMCPY( DST, SRC, BYTES) \