summaryrefslogtreecommitdiff
path: root/src/mesa/main/macros.h
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>1999-10-10 12:39:04 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>1999-10-10 12:39:04 +0000
commitd77fa3076182f60d9e7f835b164aa17f28cf512f (patch)
tree2a6b72918008d0800e72afc0354a8ff34c15bc53 /src/mesa/main/macros.h
parent73d03344f43d0f5c7f25a1fea13b5c2bad37dfd9 (diff)
added memory macros
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 e47b85ff8b..9af40398d0 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) \