-/* $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
#include "all.h"
#else
#ifndef XFree86Server
-#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#else
{
/* 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) {
-/* $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
/* 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;
*/
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;
}
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:
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:
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) {
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 );
}
-
-
void gl_compile_cassette( GLcontext *ctx )
{
Node *n = alloc_instruction( ctx, OPCODE_VERTEX_CASSETTE, 1 );
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 );
}
/* 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;
/* KW: Put back the old input pointer.
*/
- free( ctx->input );
+ GL_FREE( ctx->input );
SET_IMMEDIATE( ctx, ctx->VB->IM );
gl_reset_input( ctx );
-/* $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
#include "GL/gl.h"
#include "enums.h"
+#include "macros.h"
#include <stdlib.h>
#include <string.h>
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),
-/* $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
*/
-
-
-
/*
* eval.c was written by
* Bernd Barsuhn (bdbarsuh@cip.informatik.uni-erlangen.de) and
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)
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)
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;
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;
else {
/* The control points in the display list are not currently */
/* being used. */
- free( data );
+ GL_FREE( data );
}
}
if (map2) {
else {
/* The control points in the display list are not currently */
/* being used. */
- free( data );
+ GL_FREE( data );
}
}
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
}
return;
}
}
-
-/* $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
#define MAX_EXT_NAMELEN 80
-#define MALLOC_STRUCT(T) (struct T *) malloc( sizeof(struct T) )
struct extension {
struct extension *next, *prev;
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;
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;
}
}
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++) {
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)
-/* $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
void gl_free_image( struct gl_image *image )
{
if (image->Data) {
- free(image->Data);
+ GL_FREE(image->Data);
}
- free(image);
+ GL_FREE(image);
}
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)
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;
/* 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;
}
GL_COLOR_INDEX, GL_BITMAP,
0, i, 0 );
if (!src) {
- free(buffer);
+ GL_FREE(buffer);
return NULL;
}
MEMCPY( dst, src, width_in_bytes );
image->RefCount = 0;
}
else {
- free( buffer );
+ GL_FREE( buffer );
return NULL;
}
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;
}
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 );
image->RefCount = 0;
}
else {
- free( buffer );
+ GL_FREE( buffer );
}
return image;
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;
-/* $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
void gl_matrix_dtr( GLmatrix *m )
{
if (m->inv != 0) {
- free(m->inv);
+ GL_FREE(m->inv);
m->inv = 0;
}
}
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) );
}
}
-/* $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
/* 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 );
-/* $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
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);
}
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 );
}
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 */
/* 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
/*
* 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;
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;
}
}