summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/depth.c7
-rw-r--r--src/mesa/main/dlist.c35
-rw-r--r--src/mesa/main/enums.c5
-rw-r--r--src/mesa/main/eval.c60
-rw-r--r--src/mesa/main/extensions.c15
-rw-r--r--src/mesa/main/image.c28
-rw-r--r--src/mesa/main/matrix.c6
-rw-r--r--src/mesa/main/stencil.c6
-rw-r--r--src/mesa/main/teximage.c18
9 files changed, 86 insertions, 94 deletions
diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c
index 0dfab9aded7..12d226d530f 100644
--- a/src/mesa/main/depth.c
+++ b/src/mesa/main/depth.c
@@ -1,4 +1,4 @@
-/* $Id: depth.c,v 1.4 1999/10/08 09:27:10 keithw Exp $ */
+/* $Id: depth.c,v 1.5 1999/10/10 12:51:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -36,7 +36,6 @@
#include "all.h"
#else
#ifndef XFree86Server
-#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#else
@@ -812,12 +811,12 @@ void gl_alloc_depth_buffer( GLcontext* ctx )
{
/* deallocate current depth buffer if present */
if (ctx->Buffer->Depth) {
- free(ctx->Buffer->Depth);
+ GL_FREE(ctx->Buffer->Depth);
ctx->Buffer->Depth = NULL;
}
/* allocate new depth buffer, but don't initialize it */
- ctx->Buffer->Depth = (GLdepth *) malloc( ctx->Buffer->Width
+ ctx->Buffer->Depth = (GLdepth *) GL_ALLOC( ctx->Buffer->Width
* ctx->Buffer->Height
* sizeof(GLdepth) );
if (!ctx->Buffer->Depth) {
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index fa13ce0afed..ec36bd4a281 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -1,4 +1,4 @@
-/* $Id: dlist.c,v 1.7 1999/10/09 10:01:46 brianp Exp $ */
+/* $Id: dlist.c,v 1.8 1999/10/10 12:51:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -303,7 +303,7 @@ static Node *alloc_instruction( GLcontext *ctx, OpCode opcode, GLint argcount )
/* This block is full. Allocate a new block and chain to it */
n = ctx->CurrentBlock + ctx->CurrentPos;
n[0].opcode = OPCODE_CONTINUE;
- newblock = (Node *) malloc( sizeof(Node) * BLOCK_SIZE );
+ newblock = (Node *) GL_ALLOC( sizeof(Node) * BLOCK_SIZE );
if (!newblock) {
gl_error( ctx, GL_OUT_OF_MEMORY, "Building display list" );
return NULL;
@@ -329,7 +329,7 @@ static Node *alloc_instruction( GLcontext *ctx, OpCode opcode, GLint argcount )
*/
static Node *make_empty_list( void )
{
- Node *n = (Node *) malloc( sizeof(Node) );
+ Node *n = (Node *) GL_ALLOC( sizeof(Node) );
n[0].opcode = OPCODE_END_OF_LIST;
return n;
}
@@ -385,7 +385,7 @@ void gl_destroy_list( GLcontext *ctx, GLuint list )
n += InstSize[n[0].opcode];
break;
case OPCODE_POLYGON_STIPPLE:
- free( n[1].data );
+ GL_FREE( n[1].data );
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_IMAGE1D:
@@ -412,11 +412,11 @@ void gl_destroy_list( GLcontext *ctx, GLuint list )
break;
case OPCODE_CONTINUE:
n = (Node *) n[1].next;
- free( block );
+ GL_FREE( block );
block = n;
break;
case OPCODE_END_OF_LIST:
- free( block );
+ GL_FREE( block );
done = GL_TRUE;
break;
default:
@@ -1670,7 +1670,7 @@ static void save_PixelMapfv( GLcontext *ctx,
if (n) {
n[1].e = map;
n[2].i = mapsize;
- n[3].data = (void *) malloc( mapsize * sizeof(GLfloat) );
+ n[3].data = (void *) GL_ALLOC( mapsize * sizeof(GLfloat) );
MEMCPY( n[3].data, (void *) values, mapsize * sizeof(GLfloat) );
}
if (ctx->ExecuteFlag) {
@@ -1766,7 +1766,7 @@ static void save_PolygonStipple( GLcontext *ctx, const GLuint *pattern )
n = alloc_instruction( ctx, OPCODE_POLYGON_STIPPLE, 1 );
if (n) {
void *data;
- n[1].data = malloc( 32 * 4 );
+ n[1].data = GL_ALLOC( 32 * 4 );
data = n[1].data; /* This needed for Acorn compiler */
MEMCPY( data, pattern, 32 * 4 );
}
@@ -2380,8 +2380,6 @@ static void save_ClientActiveTexture( GLcontext *ctx, GLenum target )
-
-
void gl_compile_cassette( GLcontext *ctx )
{
Node *n = alloc_instruction( ctx, OPCODE_VERTEX_CASSETTE, 1 );
@@ -2389,21 +2387,20 @@ void gl_compile_cassette( GLcontext *ctx )
struct immediate *im = ctx->input;
if (!n || !new_im) {
- if (n) free(n);
- if (new_im) gl_immediate_free(new_im);
+ if (n)
+ GL_FREE(n);
+ if (new_im)
+ gl_immediate_free(new_im);
return;
}
/* Do some easy optimizations of the cassette.
*/
- if (im->v.Obj.size < 4 &&
- im->Count > 15)
- {
- im->Bounds = (GLfloat (*)[3]) malloc(6 * sizeof(GLfloat));
+ if (im->v.Obj.size < 4 && im->Count > 15) {
+ im->Bounds = (GLfloat (*)[3]) GL_ALLOC(6 * sizeof(GLfloat));
(gl_calc_bound_tab[im->v.Obj.size])( im->Bounds, &im->v.Obj );
}
-
n[1].data = (void *)im;
SET_IMMEDIATE( ctx, new_im );
}
@@ -3041,7 +3038,7 @@ void gl_NewList( GLcontext *ctx, GLuint list, GLenum mode )
/* Allocate new display list */
ctx->CurrentListNum = list;
- ctx->CurrentBlock = (Node *) malloc( sizeof(Node) * BLOCK_SIZE );
+ ctx->CurrentBlock = (Node *) GL_ALLOC( sizeof(Node) * BLOCK_SIZE );
ctx->CurrentListPtr = ctx->CurrentBlock;
ctx->CurrentPos = 0;
@@ -3092,7 +3089,7 @@ void gl_EndList( GLcontext *ctx )
/* KW: Put back the old input pointer.
*/
- free( ctx->input );
+ GL_FREE( ctx->input );
SET_IMMEDIATE( ctx, ctx->VB->IM );
gl_reset_input( ctx );
diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c
index 69b520ef403..ab94f506152 100644
--- a/src/mesa/main/enums.c
+++ b/src/mesa/main/enums.c
@@ -1,4 +1,4 @@
-/* $Id: enums.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: enums.c,v 1.2 1999/10/10 12:51:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -27,6 +27,7 @@
#include "GL/gl.h"
#include "enums.h"
+#include "macros.h"
#include <stdlib.h>
#include <string.h>
@@ -824,7 +825,7 @@ static int compar_nr( const enum_elt **a, const enum_elt **b )
static void sort_enums( void )
{
int i;
- index1 = (enum_elt **)malloc( Elements(all_enums) * sizeof(enum_elt *) );
+ index1 = (enum_elt **)GL_ALLOC( Elements(all_enums) * sizeof(enum_elt *) );
sorted = 1;
qsort( all_enums, Elements(all_enums), sizeof(*all_enums),
diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c
index 4d5b067ebe2..f391b80407b 100644
--- a/src/mesa/main/eval.c
+++ b/src/mesa/main/eval.c
@@ -1,4 +1,4 @@
-/* $Id: eval.c,v 1.2 1999/10/08 09:27:10 keithw Exp $ */
+/* $Id: eval.c,v 1.3 1999/10/10 12:54:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -25,9 +25,6 @@
*/
-
-
-
/*
* eval.c was written by
* Bernd Barsuhn ([email protected]) and
@@ -585,7 +582,7 @@ GLfloat *gl_copy_map_points1f( GLenum target,
return NULL;
}
- buffer = (GLfloat *) malloc(uorder * size * sizeof(GLfloat));
+ buffer = (GLfloat *) GL_ALLOC(uorder * size * sizeof(GLfloat));
if(buffer)
for(i=0, p=buffer; i<uorder; i++, points+=ustride)
@@ -611,7 +608,7 @@ GLfloat *gl_copy_map_points1d( GLenum target,
return NULL;
}
- buffer = (GLfloat *) malloc(uorder * size * sizeof(GLfloat));
+ buffer = (GLfloat *) GL_ALLOC(uorder * size * sizeof(GLfloat));
if(buffer)
for(i=0, p=buffer; i<uorder; i++, points+=ustride)
@@ -655,9 +652,9 @@ GLfloat *gl_copy_map_points2f( GLenum target,
hsize = (uorder > vorder ? uorder : vorder)*size;
if(hsize>dsize)
- buffer = (GLfloat *) malloc((uorder*vorder*size+hsize)*sizeof(GLfloat));
+ buffer = (GLfloat *) GL_ALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat));
else
- buffer = (GLfloat *) malloc((uorder*vorder*size+dsize)*sizeof(GLfloat));
+ buffer = (GLfloat *) GL_ALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat));
/* compute the increment value for the u-loop */
uinc = ustride - vorder*vstride;
@@ -698,9 +695,9 @@ GLfloat *gl_copy_map_points2d(GLenum target,
hsize = (uorder > vorder ? uorder : vorder)*size;
if(hsize>dsize)
- buffer = (GLfloat *) malloc((uorder*vorder*size+hsize)*sizeof(GLfloat));
+ buffer = (GLfloat *) GL_ALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat));
else
- buffer = (GLfloat *) malloc((uorder*vorder*size+dsize)*sizeof(GLfloat));
+ buffer = (GLfloat *) GL_ALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat));
/* compute the increment value for the u-loop */
uinc = ustride - vorder*vstride;
@@ -793,7 +790,7 @@ void gl_free_control_points( GLcontext* ctx, GLenum target, GLfloat *data )
else {
/* The control points in the display list are not currently */
/* being used. */
- free( data );
+ GL_FREE( data );
}
}
if (map2) {
@@ -805,7 +802,7 @@ void gl_free_control_points( GLcontext* ctx, GLenum target, GLfloat *data )
else {
/* The control points in the display list are not currently */
/* being used. */
- free( data );
+ GL_FREE( data );
}
}
@@ -867,7 +864,7 @@ void gl_Map1f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map1Vertex3.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Vertex3.Points
&& !ctx->EvalMap.Map1Vertex3.Retain) {
- free( ctx->EvalMap.Map1Vertex3.Points );
+ GL_FREE( ctx->EvalMap.Map1Vertex3.Points );
}
ctx->EvalMap.Map1Vertex3.Points = (GLfloat *) points;
ctx->EvalMap.Map1Vertex3.Retain = retain;
@@ -879,7 +876,7 @@ void gl_Map1f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map1Vertex4.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Vertex4.Points
&& !ctx->EvalMap.Map1Vertex4.Retain) {
- free( ctx->EvalMap.Map1Vertex4.Points );
+ GL_FREE( ctx->EvalMap.Map1Vertex4.Points );
}
ctx->EvalMap.Map1Vertex4.Points = (GLfloat *) points;
ctx->EvalMap.Map1Vertex4.Retain = retain;
@@ -891,7 +888,7 @@ void gl_Map1f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map1Index.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Index.Points
&& !ctx->EvalMap.Map1Index.Retain) {
- free( ctx->EvalMap.Map1Index.Points );
+ GL_FREE( ctx->EvalMap.Map1Index.Points );
}
ctx->EvalMap.Map1Index.Points = (GLfloat *) points;
ctx->EvalMap.Map1Index.Retain = retain;
@@ -903,7 +900,7 @@ void gl_Map1f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map1Color4.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Color4.Points
&& !ctx->EvalMap.Map1Color4.Retain) {
- free( ctx->EvalMap.Map1Color4.Points );
+ GL_FREE( ctx->EvalMap.Map1Color4.Points );
}
ctx->EvalMap.Map1Color4.Points = (GLfloat *) points;
ctx->EvalMap.Map1Color4.Retain = retain;
@@ -915,7 +912,7 @@ void gl_Map1f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map1Normal.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Normal.Points
&& !ctx->EvalMap.Map1Normal.Retain) {
- free( ctx->EvalMap.Map1Normal.Points );
+ GL_FREE( ctx->EvalMap.Map1Normal.Points );
}
ctx->EvalMap.Map1Normal.Points = (GLfloat *) points;
ctx->EvalMap.Map1Normal.Retain = retain;
@@ -927,7 +924,7 @@ void gl_Map1f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map1Texture1.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Texture1.Points
&& !ctx->EvalMap.Map1Texture1.Retain) {
- free( ctx->EvalMap.Map1Texture1.Points );
+ GL_FREE( ctx->EvalMap.Map1Texture1.Points );
}
ctx->EvalMap.Map1Texture1.Points = (GLfloat *) points;
ctx->EvalMap.Map1Texture1.Retain = retain;
@@ -939,7 +936,7 @@ void gl_Map1f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map1Texture2.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Texture2.Points
&& !ctx->EvalMap.Map1Texture2.Retain) {
- free( ctx->EvalMap.Map1Texture2.Points );
+ GL_FREE( ctx->EvalMap.Map1Texture2.Points );
}
ctx->EvalMap.Map1Texture2.Points = (GLfloat *) points;
ctx->EvalMap.Map1Texture2.Retain = retain;
@@ -951,7 +948,7 @@ void gl_Map1f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map1Texture3.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Texture3.Points
&& !ctx->EvalMap.Map1Texture3.Retain) {
- free( ctx->EvalMap.Map1Texture3.Points );
+ GL_FREE( ctx->EvalMap.Map1Texture3.Points );
}
ctx->EvalMap.Map1Texture3.Points = (GLfloat *) points;
ctx->EvalMap.Map1Texture3.Retain = retain;
@@ -963,7 +960,7 @@ void gl_Map1f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map1Texture4.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Texture4.Points
&& !ctx->EvalMap.Map1Texture4.Retain) {
- free( ctx->EvalMap.Map1Texture4.Points );
+ GL_FREE( ctx->EvalMap.Map1Texture4.Points );
}
ctx->EvalMap.Map1Texture4.Points = (GLfloat *) points;
ctx->EvalMap.Map1Texture4.Retain = retain;
@@ -1036,7 +1033,7 @@ void gl_Map2f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map2Vertex3.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Vertex3.Points
&& !ctx->EvalMap.Map2Vertex3.Retain) {
- free( ctx->EvalMap.Map2Vertex3.Points );
+ GL_FREE( ctx->EvalMap.Map2Vertex3.Points );
}
ctx->EvalMap.Map2Vertex3.Retain = retain;
ctx->EvalMap.Map2Vertex3.Points = (GLfloat *) points;
@@ -1052,7 +1049,7 @@ void gl_Map2f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map2Vertex4.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Vertex4.Points
&& !ctx->EvalMap.Map2Vertex4.Retain) {
- free( ctx->EvalMap.Map2Vertex4.Points );
+ GL_FREE( ctx->EvalMap.Map2Vertex4.Points );
}
ctx->EvalMap.Map2Vertex4.Points = (GLfloat *) points;
ctx->EvalMap.Map2Vertex4.Retain = retain;
@@ -1068,7 +1065,7 @@ void gl_Map2f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map2Index.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Index.Points
&& !ctx->EvalMap.Map2Index.Retain) {
- free( ctx->EvalMap.Map2Index.Points );
+ GL_FREE( ctx->EvalMap.Map2Index.Points );
}
ctx->EvalMap.Map2Index.Retain = retain;
ctx->EvalMap.Map2Index.Points = (GLfloat *) points;
@@ -1084,7 +1081,7 @@ void gl_Map2f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map2Color4.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Color4.Points
&& !ctx->EvalMap.Map2Color4.Retain) {
- free( ctx->EvalMap.Map2Color4.Points );
+ GL_FREE( ctx->EvalMap.Map2Color4.Points );
}
ctx->EvalMap.Map2Color4.Retain = retain;
ctx->EvalMap.Map2Color4.Points = (GLfloat *) points;
@@ -1100,7 +1097,7 @@ void gl_Map2f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map2Normal.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Normal.Points
&& !ctx->EvalMap.Map2Normal.Retain) {
- free( ctx->EvalMap.Map2Normal.Points );
+ GL_FREE( ctx->EvalMap.Map2Normal.Points );
}
ctx->EvalMap.Map2Normal.Retain = retain;
ctx->EvalMap.Map2Normal.Points = (GLfloat *) points;
@@ -1116,7 +1113,7 @@ void gl_Map2f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map2Texture1.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Texture1.Points
&& !ctx->EvalMap.Map2Texture1.Retain) {
- free( ctx->EvalMap.Map2Texture1.Points );
+ GL_FREE( ctx->EvalMap.Map2Texture1.Points );
}
ctx->EvalMap.Map2Texture1.Retain = retain;
ctx->EvalMap.Map2Texture1.Points = (GLfloat *) points;
@@ -1132,7 +1129,7 @@ void gl_Map2f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map2Texture2.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Texture2.Points
&& !ctx->EvalMap.Map2Texture2.Retain) {
- free( ctx->EvalMap.Map2Texture2.Points );
+ GL_FREE( ctx->EvalMap.Map2Texture2.Points );
}
ctx->EvalMap.Map2Texture2.Retain = retain;
ctx->EvalMap.Map2Texture2.Points = (GLfloat *) points;
@@ -1148,7 +1145,7 @@ void gl_Map2f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map2Texture3.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Texture3.Points
&& !ctx->EvalMap.Map2Texture3.Retain) {
- free( ctx->EvalMap.Map2Texture3.Points );
+ GL_FREE( ctx->EvalMap.Map2Texture3.Points );
}
ctx->EvalMap.Map2Texture3.Retain = retain;
ctx->EvalMap.Map2Texture3.Points = (GLfloat *) points;
@@ -1164,7 +1161,7 @@ void gl_Map2f( GLcontext* ctx, GLenum target,
ctx->EvalMap.Map2Texture4.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Texture4.Points
&& !ctx->EvalMap.Map2Texture4.Retain) {
- free( ctx->EvalMap.Map2Texture4.Points );
+ GL_FREE( ctx->EvalMap.Map2Texture4.Points );
}
ctx->EvalMap.Map2Texture4.Retain = retain;
ctx->EvalMap.Map2Texture4.Points = (GLfloat *) points;
@@ -2560,7 +2557,7 @@ void gl_eval_vb( struct vertex_buffer *VB )
GLuint count = VB->Count;
if (!flags) {
- VB->EvaluatedFlags = (GLuint *)malloc(VB->Size * sizeof(GLuint));
+ VB->EvaluatedFlags = (GLuint *) GL_ALLOC(VB->Size * sizeof(GLuint));
flags = VB->Flag = VB->EvaluatedFlags;
}
@@ -2726,4 +2723,3 @@ void gl_EvalMesh2( GLcontext* ctx,
return;
}
}
-
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 803b650ce6a..08d524f3519 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -1,4 +1,4 @@
-/* $Id: extensions.c,v 1.5 1999/10/08 09:27:10 keithw Exp $ */
+/* $Id: extensions.c,v 1.6 1999/10/10 12:54:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -33,7 +33,6 @@
#define MAX_EXT_NAMELEN 80
-#define MALLOC_STRUCT(T) (struct T *) malloc( sizeof(struct T) )
struct extension {
struct extension *next, *prev;
@@ -83,7 +82,7 @@ int gl_extensions_add( GLcontext *ctx,
if (ctx->Extensions.ext_string == 0)
{
- struct extension *t = MALLOC_STRUCT(extension);
+ struct extension *t = GL_ALLOC_STRUCT(extension);
t->enabled = state;
strncpy(t->name, name, MAX_EXT_NAMELEN);
t->name[MAX_EXT_NAMELEN] = 0;
@@ -135,17 +134,17 @@ void gl_extensions_dtr( GLcontext *ctx )
struct extension *i, *nexti;
if (ctx->Extensions.ext_string) {
- free( ctx->Extensions.ext_string );
+ GL_FREE( ctx->Extensions.ext_string );
ctx->Extensions.ext_string = 0;
}
if (ctx->Extensions.ext_list) {
foreach_s( i, nexti, ctx->Extensions.ext_list ) {
remove_from_list( i );
- free( i );
+ GL_FREE( i );
}
- free(ctx->Extensions.ext_list);
+ GL_FREE(ctx->Extensions.ext_list);
ctx->Extensions.ext_list = 0;
}
}
@@ -156,7 +155,7 @@ void gl_extensions_ctr( GLcontext *ctx )
GLuint i;
ctx->Extensions.ext_string = 0;
- ctx->Extensions.ext_list = MALLOC_STRUCT(extension);
+ ctx->Extensions.ext_list = GL_ALLOC_STRUCT(extension);
make_empty_list( ctx->Extensions.ext_list );
for (i = 0 ; i < Elements(default_extensions) ; i++) {
@@ -182,7 +181,7 @@ const char *gl_extensions_get_string( GLcontext *ctx )
if (len == 0)
return "";
- str = (char *)malloc(len * sizeof(char));
+ str = (char *)GL_ALLOC(len * sizeof(char));
ctx->Extensions.ext_string = str;
foreach (i, ctx->Extensions.ext_list)
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index acdce62eaa5..b963d16c9b3 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.3 1999/10/08 09:27:10 keithw Exp $ */
+/* $Id: image.c,v 1.4 1999/10/10 12:54:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -515,9 +515,9 @@ static struct gl_image *alloc_error_image( GLint width, GLint height,
void gl_free_image( struct gl_image *image )
{
if (image->Data) {
- free(image->Data);
+ GL_FREE(image->Data);
}
- free(image);
+ GL_FREE(image);
}
@@ -575,15 +575,15 @@ unpack_depth_image( GLcontext *ctx, GLenum type, GLint width, GLint height,
image->Format = GL_DEPTH_COMPONENT;
if (type==GL_UNSIGNED_SHORT) {
image->Type = GL_UNSIGNED_SHORT;
- image->Data = malloc( width * height * sizeof(GLushort));
+ image->Data = GL_ALLOC( width * height * sizeof(GLushort));
}
else if (type==GL_UNSIGNED_INT) {
image->Type = GL_UNSIGNED_INT;
- image->Data = malloc( width * height * sizeof(GLuint));
+ image->Data = GL_ALLOC( width * height * sizeof(GLuint));
}
else {
image->Type = GL_FLOAT;
- image->Data = malloc( width * height * sizeof(GLfloat));
+ image->Data = GL_ALLOC( width * height * sizeof(GLfloat));
}
image->RefCount = 0;
if (!image->Data)
@@ -711,7 +711,7 @@ unpack_stencil_image( GLcontext *ctx, GLenum type, GLint width, GLint height,
image->Components = 1;
image->Format = GL_STENCIL_INDEX;
image->Type = GL_UNSIGNED_BYTE;
- image->Data = malloc( width * height * sizeof(GLubyte));
+ image->Data = GL_ALLOC( width * height * sizeof(GLubyte));
image->RefCount = 0;
if (!image->Data)
return image;
@@ -825,7 +825,7 @@ unpack_bitmap( GLenum format, GLint width, GLint height,
/* Alloc dest storage */
bytes = ((width+7)/8 * height);
if (bytes>0 && pixels!=NULL) {
- buffer = (GLubyte *) malloc( bytes );
+ buffer = (GLubyte *) GL_ALLOC( bytes );
if (!buffer) {
return NULL;
}
@@ -838,7 +838,7 @@ unpack_bitmap( GLenum format, GLint width, GLint height,
GL_COLOR_INDEX, GL_BITMAP,
0, i, 0 );
if (!src) {
- free(buffer);
+ GL_FREE(buffer);
return NULL;
}
MEMCPY( dst, src, width_in_bytes );
@@ -866,7 +866,7 @@ unpack_bitmap( GLenum format, GLint width, GLint height,
image->RefCount = 0;
}
else {
- free( buffer );
+ GL_FREE( buffer );
return NULL;
}
@@ -943,7 +943,7 @@ unpack_ubyte_image( GLint width, GLint height,
components = gl_components_in_format( format );
width_in_bytes = width * components * sizeof(GLubyte);
- buffer = (GLubyte *) malloc( height * width_in_bytes * depth );
+ buffer = (GLubyte *) GL_ALLOC( height * width_in_bytes * depth );
if (!buffer) {
return NULL;
}
@@ -956,7 +956,7 @@ unpack_ubyte_image( GLint width, GLint height,
pixels, width, height, format, GL_UNSIGNED_BYTE,
d, i, 0 );
if (!src) {
- free(buffer);
+ GL_FREE(buffer);
return NULL;
}
MEMCPY( dst, src, width_in_bytes );
@@ -1016,7 +1016,7 @@ unpack_ubyte_image( GLint width, GLint height,
image->RefCount = 0;
}
else {
- free( buffer );
+ GL_FREE( buffer );
}
return image;
@@ -1077,7 +1077,7 @@ unpack_float_image( GLcontext *ctx, GLint width, GLint height, GLint depth,
else
image->Format = format;
image->Type = GL_FLOAT;
- image->Data = malloc( elems_per_row * height * depth * sizeof(GLfloat));
+ image->Data = GL_ALLOC( elems_per_row * height * depth * sizeof(GLfloat));
image->RefCount = 0;
if (!image->Data)
return image;
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index 154a038b923..a5b080e2bd4 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -1,4 +1,4 @@
-/* $Id: matrix.c,v 1.5 1999/10/08 09:27:11 keithw Exp $ */
+/* $Id: matrix.c,v 1.6 1999/10/10 12:56:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1410,7 +1410,7 @@ void gl_matrix_ctr( GLmatrix *m )
void gl_matrix_dtr( GLmatrix *m )
{
if (m->inv != 0) {
- free(m->inv);
+ GL_FREE(m->inv);
m->inv = 0;
}
}
@@ -1426,7 +1426,7 @@ void gl_matrix_set_identity( GLmatrix *m )
void gl_matrix_alloc_inv( GLmatrix *m )
{
if (m->inv == 0) {
- m->inv = (GLfloat *)malloc(16*sizeof(GLfloat));
+ m->inv = (GLfloat *)GL_ALLOC(16*sizeof(GLfloat));
MEMCPY( m->inv, Identity, 16 * sizeof(GLfloat) );
}
}
diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c
index 95dbfbfbd15..3868a803cbb 100644
--- a/src/mesa/main/stencil.c
+++ b/src/mesa/main/stencil.c
@@ -1,4 +1,4 @@
-/* $Id: stencil.c,v 1.4 1999/10/08 09:27:11 keithw Exp $ */
+/* $Id: stencil.c,v 1.5 1999/10/10 12:56:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1056,12 +1056,12 @@ void gl_alloc_stencil_buffer( GLcontext *ctx )
/* deallocate current stencil buffer if present */
if (ctx->Buffer->Stencil) {
- free(ctx->Buffer->Stencil);
+ GL_FREE(ctx->Buffer->Stencil);
ctx->Buffer->Stencil = NULL;
}
/* allocate new stencil buffer */
- ctx->Buffer->Stencil = (GLstencil *) malloc(buffersize * sizeof(GLstencil));
+ ctx->Buffer->Stencil = (GLstencil *) GL_ALLOC(buffersize * sizeof(GLstencil));
if (!ctx->Buffer->Stencil) {
/* out of memory */
gl_set_enable( ctx, GL_STENCIL_TEST, GL_FALSE );
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index aa3fbbb15ef..f6ef4238646 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1,4 +1,4 @@
-/* $Id: teximage.c,v 1.2 1999/10/08 09:27:11 keithw Exp $ */
+/* $Id: teximage.c,v 1.3 1999/10/10 12:56:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -236,7 +236,7 @@ static GLint components_in_intformat( GLint format )
struct gl_texture_image *gl_alloc_texture_image( void )
{
- return (struct gl_texture_image *) calloc( 1, sizeof(struct gl_texture_image) );
+ return GL_CALLOC_STRUCT(gl_texture_image);
}
@@ -244,9 +244,9 @@ struct gl_texture_image *gl_alloc_texture_image( void )
void gl_free_texture_image( struct gl_texture_image *teximage )
{
if (teximage->Data) {
- free( teximage->Data );
+ GL_FREE( teximage->Data );
}
- free( teximage );
+ GL_FREE( teximage );
}
@@ -389,7 +389,7 @@ image_to_texture( GLcontext *ctx, const struct gl_image *image,
texImage->Height2 = 1 << texImage->HeightLog2;
texImage->Depth2 = 1 << texImage->DepthLog2;
texImage->MaxLog2 = MAX2( texImage->WidthLog2, texImage->HeightLog2 );
- texImage->Data = (GLubyte *) malloc( numPixels * components + EXTRA_BYTE );
+ texImage->Data = (GLubyte *) GL_ALLOC( numPixels * components + EXTRA_BYTE );
if (!texImage->Data) {
/* out of memory */
@@ -872,7 +872,7 @@ make_null_texture( GLcontext *ctx, GLenum internalFormat,
/* XXX should we really allocate memory for the image or let it be NULL? */
/*texImage->Data = NULL;*/
- texImage->Data = (GLubyte *) malloc( numPixels * components + EXTRA_BYTE );
+ texImage->Data = (GLubyte *) GL_ALLOC( numPixels * components + EXTRA_BYTE );
/*
* Let's see if anyone finds this. If glTexImage2D() is called with
@@ -1882,7 +1882,7 @@ static struct gl_image *read_color_image( GLcontext *ctx, GLint x, GLint y,
/*
* Allocate image struct and image data buffer
*/
- image = (struct gl_image *) malloc( sizeof(struct gl_image) );
+ image = GL_ALLOC_STRUCT( gl_image );
if (image) {
image->Width = width;
image->Height = height;
@@ -1891,9 +1891,9 @@ static struct gl_image *read_color_image( GLcontext *ctx, GLint x, GLint y,
image->Format = format;
image->Type = GL_UNSIGNED_BYTE;
image->RefCount = 0;
- image->Data = (GLubyte *) malloc( width * height * components );
+ image->Data = (GLubyte *) GL_ALLOC( width * height * components );
if (!image->Data) {
- free(image);
+ GL_FREE(image);
return NULL;
}
}