diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/accum.c | 8 | ||||
-rw-r--r-- | src/mesa/main/attrib.c | 58 | ||||
-rw-r--r-- | src/mesa/main/context.c | 112 | ||||
-rw-r--r-- | src/mesa/main/depth.c | 6 | ||||
-rw-r--r-- | src/mesa/main/dlist.c | 24 | ||||
-rw-r--r-- | src/mesa/main/enums.c | 4 | ||||
-rw-r--r-- | src/mesa/main/eval.c | 56 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 14 | ||||
-rw-r--r-- | src/mesa/main/hash.c | 15 | ||||
-rw-r--r-- | src/mesa/main/image.c | 30 | ||||
-rw-r--r-- | src/mesa/main/macros.h | 24 | ||||
-rw-r--r-- | src/mesa/main/matrix.c | 6 | ||||
-rw-r--r-- | src/mesa/main/stencil.c | 6 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 18 | ||||
-rw-r--r-- | src/mesa/main/texobj.c | 4 |
15 files changed, 192 insertions, 193 deletions
diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index a053730bb3e..b7bb3f6e854 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -1,4 +1,4 @@ -/* $Id: accum.c,v 1.5 1999/10/11 04:20:25 joukj Exp $ */ +/* $Id: accum.c,v 1.6 1999/10/13 18:42:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -80,13 +80,13 @@ void gl_alloc_accum_buffer( GLcontext *ctx ) GLint n; if (ctx->Buffer->Accum) { - GL_FREE( ctx->Buffer->Accum ); + FREE( ctx->Buffer->Accum ); ctx->Buffer->Accum = NULL; } /* allocate accumulation buffer if not already present */ n = ctx->Buffer->Width * ctx->Buffer->Height * 4 * sizeof(GLaccum); - ctx->Buffer->Accum = (GLaccum *) GL_ALLOC( n ); + ctx->Buffer->Accum = (GLaccum *) MALLOC( n ); if (!ctx->Buffer->Accum) { /* unable to setup accumulation buffer */ gl_error( ctx, GL_OUT_OF_MEMORY, "glAccum" ); @@ -429,7 +429,7 @@ void gl_clear_accum_buffer( GLcontext *ctx ) if (!ctx->Buffer->Accum) { /* try to alloc accumulation buffer */ ctx->Buffer->Accum = (GLaccum *) - GL_ALLOC( buffersize * 4 * sizeof(GLaccum) ); + MALLOC( buffersize * 4 * sizeof(GLaccum) ); } if (ctx->Buffer->Accum) { diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 7e4a31284c0..db11a3d2217 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $Id: attrib.c,v 1.7 1999/10/11 04:20:55 joukj Exp $ */ +/* $Id: attrib.c,v 1.8 1999/10/13 18:42:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -60,7 +60,7 @@ */ static struct gl_attrib_node *new_attrib_node( GLbitfield kind ) { - struct gl_attrib_node *an = GL_ALLOC_STRUCT(gl_attrib_node); + struct gl_attrib_node *an = MALLOC_STRUCT(gl_attrib_node); if (an) { an->kind = kind; } @@ -128,7 +128,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_ACCUM_BUFFER_BIT) { struct gl_accum_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_accum_attrib ); + attr = MALLOC_STRUCT( gl_accum_attrib ); MEMCPY( attr, &ctx->Accum, sizeof(struct gl_accum_attrib) ); newnode = new_attrib_node( GL_ACCUM_BUFFER_BIT ); newnode->data = attr; @@ -138,7 +138,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_COLOR_BUFFER_BIT) { struct gl_colorbuffer_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_colorbuffer_attrib ); + attr = MALLOC_STRUCT( gl_colorbuffer_attrib ); MEMCPY( attr, &ctx->Color, sizeof(struct gl_colorbuffer_attrib) ); newnode = new_attrib_node( GL_COLOR_BUFFER_BIT ); newnode->data = attr; @@ -148,7 +148,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_CURRENT_BIT) { struct gl_current_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_current_attrib ); + attr = MALLOC_STRUCT( gl_current_attrib ); MEMCPY( attr, &ctx->Current, sizeof(struct gl_current_attrib) ); newnode = new_attrib_node( GL_CURRENT_BIT ); newnode->data = attr; @@ -158,7 +158,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_DEPTH_BUFFER_BIT) { struct gl_depthbuffer_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_depthbuffer_attrib ); + attr = MALLOC_STRUCT( gl_depthbuffer_attrib ); MEMCPY( attr, &ctx->Depth, sizeof(struct gl_depthbuffer_attrib) ); newnode = new_attrib_node( GL_DEPTH_BUFFER_BIT ); newnode->data = attr; @@ -169,7 +169,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_ENABLE_BIT) { struct gl_enable_attrib *attr; GLuint i; - attr = GL_ALLOC_STRUCT( gl_enable_attrib ); + attr = MALLOC_STRUCT( gl_enable_attrib ); /* Copy enable flags from all other attributes into the enable struct. */ attr->AlphaTest = ctx->Color.AlphaEnabled; attr->AutoNormal = ctx->Eval.AutoNormal; @@ -230,7 +230,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_EVAL_BIT) { struct gl_eval_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_eval_attrib ); + attr = MALLOC_STRUCT( gl_eval_attrib ); MEMCPY( attr, &ctx->Eval, sizeof(struct gl_eval_attrib) ); newnode = new_attrib_node( GL_EVAL_BIT ); newnode->data = attr; @@ -240,7 +240,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_FOG_BIT) { struct gl_fog_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_fog_attrib ); + attr = MALLOC_STRUCT( gl_fog_attrib ); MEMCPY( attr, &ctx->Fog, sizeof(struct gl_fog_attrib) ); newnode = new_attrib_node( GL_FOG_BIT ); newnode->data = attr; @@ -250,7 +250,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_HINT_BIT) { struct gl_hint_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_hint_attrib ); + attr = MALLOC_STRUCT( gl_hint_attrib ); MEMCPY( attr, &ctx->Hint, sizeof(struct gl_hint_attrib) ); newnode = new_attrib_node( GL_HINT_BIT ); newnode->data = attr; @@ -260,7 +260,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_LIGHTING_BIT) { struct gl_light_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_light_attrib ); + attr = MALLOC_STRUCT( gl_light_attrib ); MEMCPY( attr, &ctx->Light, sizeof(struct gl_light_attrib) ); newnode = new_attrib_node( GL_LIGHTING_BIT ); newnode->data = attr; @@ -270,7 +270,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_LINE_BIT) { struct gl_line_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_line_attrib ); + attr = MALLOC_STRUCT( gl_line_attrib ); MEMCPY( attr, &ctx->Line, sizeof(struct gl_line_attrib) ); newnode = new_attrib_node( GL_LINE_BIT ); newnode->data = attr; @@ -280,7 +280,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_LIST_BIT) { struct gl_list_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_list_attrib ); + attr = MALLOC_STRUCT( gl_list_attrib ); MEMCPY( attr, &ctx->List, sizeof(struct gl_list_attrib) ); newnode = new_attrib_node( GL_LIST_BIT ); newnode->data = attr; @@ -290,7 +290,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_PIXEL_MODE_BIT) { struct gl_pixel_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_pixel_attrib ); + attr = MALLOC_STRUCT( gl_pixel_attrib ); MEMCPY( attr, &ctx->Pixel, sizeof(struct gl_pixel_attrib) ); newnode = new_attrib_node( GL_PIXEL_MODE_BIT ); newnode->data = attr; @@ -300,7 +300,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_POINT_BIT) { struct gl_point_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_point_attrib ); + attr = MALLOC_STRUCT( gl_point_attrib ); MEMCPY( attr, &ctx->Point, sizeof(struct gl_point_attrib) ); newnode = new_attrib_node( GL_POINT_BIT ); newnode->data = attr; @@ -310,7 +310,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_POLYGON_BIT) { struct gl_polygon_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_polygon_attrib ); + attr = MALLOC_STRUCT( gl_polygon_attrib ); MEMCPY( attr, &ctx->Polygon, sizeof(struct gl_polygon_attrib) ); newnode = new_attrib_node( GL_POLYGON_BIT ); newnode->data = attr; @@ -320,7 +320,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_POLYGON_STIPPLE_BIT) { GLuint *stipple; - stipple = (GLuint *) GL_ALLOC( 32*sizeof(GLuint) ); + stipple = (GLuint *) MALLOC( 32*sizeof(GLuint) ); MEMCPY( stipple, ctx->PolygonStipple, 32*sizeof(GLuint) ); newnode = new_attrib_node( GL_POLYGON_STIPPLE_BIT ); newnode->data = stipple; @@ -330,7 +330,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_SCISSOR_BIT) { struct gl_scissor_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_scissor_attrib ); + attr = MALLOC_STRUCT( gl_scissor_attrib ); MEMCPY( attr, &ctx->Scissor, sizeof(struct gl_scissor_attrib) ); newnode = new_attrib_node( GL_SCISSOR_BIT ); newnode->data = attr; @@ -340,7 +340,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_STENCIL_BUFFER_BIT) { struct gl_stencil_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_stencil_attrib ); + attr = MALLOC_STRUCT( gl_stencil_attrib ); MEMCPY( attr, &ctx->Stencil, sizeof(struct gl_stencil_attrib) ); newnode = new_attrib_node( GL_STENCIL_BUFFER_BIT ); newnode->data = attr; @@ -357,7 +357,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) ctx->Texture.Unit[u].CurrentD[2]->RefCount++; ctx->Texture.Unit[u].CurrentD[3]->RefCount++; } - attr = GL_ALLOC_STRUCT( gl_texture_attrib ); + attr = MALLOC_STRUCT( gl_texture_attrib ); MEMCPY( attr, &ctx->Texture, sizeof(struct gl_texture_attrib) ); /* copy state of the currently bound texture objects */ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { @@ -373,7 +373,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_TRANSFORM_BIT) { struct gl_transform_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_transform_attrib ); + attr = MALLOC_STRUCT( gl_transform_attrib ); MEMCPY( attr, &ctx->Transform, sizeof(struct gl_transform_attrib) ); newnode = new_attrib_node( GL_TRANSFORM_BIT ); newnode->data = attr; @@ -383,7 +383,7 @@ void gl_PushAttrib( GLcontext* ctx, GLbitfield mask ) if (mask & GL_VIEWPORT_BIT) { struct gl_viewport_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_viewport_attrib ); + attr = MALLOC_STRUCT( gl_viewport_attrib ); MEMCPY( attr, &ctx->Viewport, sizeof(struct gl_viewport_attrib) ); newnode = new_attrib_node( GL_VIEWPORT_BIT ); newnode->data = attr; @@ -756,8 +756,8 @@ void gl_PopAttrib( GLcontext* ctx ) } next = attr->next; - GL_FREE( attr->data ); - GL_FREE( attr ); + FREE( attr->data ); + FREE( attr ); attr = next; } @@ -788,14 +788,14 @@ void gl_PushClientAttrib( GLcontext *ctx, GLbitfield mask ) if (mask & GL_CLIENT_PIXEL_STORE_BIT) { struct gl_pixelstore_attrib *attr; /* packing attribs */ - attr = GL_ALLOC_STRUCT( gl_pixelstore_attrib ); + attr = MALLOC_STRUCT( gl_pixelstore_attrib ); MEMCPY( attr, &ctx->Pack, sizeof(struct gl_pixelstore_attrib) ); newnode = new_attrib_node( GL_CLIENT_PACK_BIT ); newnode->data = attr; newnode->next = head; head = newnode; /* unpacking attribs */ - attr = GL_ALLOC_STRUCT( gl_pixelstore_attrib ); + attr = MALLOC_STRUCT( gl_pixelstore_attrib ); MEMCPY( attr, &ctx->Unpack, sizeof(struct gl_pixelstore_attrib) ); newnode = new_attrib_node( GL_CLIENT_UNPACK_BIT ); newnode->data = attr; @@ -804,7 +804,7 @@ void gl_PushClientAttrib( GLcontext *ctx, GLbitfield mask ) } if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { struct gl_array_attrib *attr; - attr = GL_ALLOC_STRUCT( gl_array_attrib ); + attr = MALLOC_STRUCT( gl_array_attrib ); MEMCPY( attr, &ctx->Array, sizeof(struct gl_array_attrib) ); newnode = new_attrib_node( GL_CLIENT_VERTEX_ARRAY_BIT ); newnode->data = attr; @@ -853,8 +853,8 @@ void gl_PopClientAttrib( GLcontext *ctx ) } next = attr->next; - GL_FREE( attr->data ); - GL_FREE( attr ); + FREE( attr->data ); + FREE( attr ); attr = next; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index a9bc00db077..ab25fd08088 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.14 1999/10/10 13:04:54 brianp Exp $ */ +/* $Id: context.c,v 1.15 1999/10/13 18:42:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -99,11 +99,11 @@ /* - * Memory allocation functions. Called via the GL_ALLOC, GL_CALLOC and - * GL_FREE macros when DEBUG symbol is defined. + * Memory allocation functions. Called via the MALLOC, CALLOC and + * FREE macros when DEBUG symbol is defined. * You might want to set breakpoints on these functions or plug in * other memory allocation functions. The Mesa sources should only - * use the GL_ALLOC and GL_FREE macros (which could also be overriden). + * use the MALLOC and FREE macros (which could also be overriden). * * XXX these functions should probably go into a new glmemory.c file. */ @@ -111,7 +111,7 @@ /* * Allocate memory (uninitialized) */ -void *gl_alloc(size_t bytes) +void *gl_malloc(size_t bytes) { return malloc(bytes); } @@ -365,7 +365,7 @@ static struct gl_shared_state *alloc_shared_state( void ) struct gl_shared_state *ss; GLboolean outOfMemory; - ss = GL_CALLOC_STRUCT(gl_shared_state); + ss = CALLOC_STRUCT(gl_shared_state); if (!ss) return NULL; @@ -396,7 +396,7 @@ static struct gl_shared_state *alloc_shared_state( void ) gl_free_texture_object(ss, ss->DefaultD[2]); if (ss->DefaultD[3]) gl_free_texture_object(ss, ss->DefaultD[3]); - GL_FREE(ss); + FREE(ss); return NULL; } else { @@ -432,7 +432,7 @@ static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) } DeleteHashTable(ss->TexObjects); - GL_FREE(ss); + FREE(ss); } @@ -575,7 +575,7 @@ static void init_1d_map( struct gl_1d_map *map, int n, const float *initial ) map->Order = 1; map->u1 = 0.0; map->u2 = 1.0; - map->Points = (GLfloat *) GL_ALLOC(n * sizeof(GLfloat)); + map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat)); if (map->Points) { GLint i; for (i=0;i<n;i++) @@ -594,7 +594,7 @@ static void init_2d_map( struct gl_2d_map *map, int n, const float *initial ) map->u2 = 1.0; map->v1 = 0.0; map->v2 = 1.0; - map->Points = (GLfloat *) GL_ALLOC(n * sizeof(GLfloat)); + map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat)); if (map->Points) { GLint i; for (i=0;i<n;i++) @@ -1127,7 +1127,7 @@ GLvisual *gl_create_visual( GLboolean rgbFlag, return NULL; } - vis = (GLvisual *) GL_CALLOC( sizeof(GLvisual) ); + vis = (GLvisual *) CALLOC( sizeof(GLvisual) ); if (!vis) { return NULL; } @@ -1154,7 +1154,7 @@ GLvisual *gl_create_visual( GLboolean rgbFlag, void gl_destroy_visual( GLvisual *vis ) { - GL_FREE( vis ); + FREE( vis ); } @@ -1250,7 +1250,7 @@ GLcontext *gl_create_context( GLvisual *visual, /* misc one-time initializations */ one_time_init(); - ctx = (GLcontext *) GL_CALLOC( sizeof(GLcontext) ); + ctx = (GLcontext *) CALLOC( sizeof(GLcontext) ); if (!ctx) { return NULL; } @@ -1261,15 +1261,15 @@ GLcontext *gl_create_context( GLvisual *visual, ctx->VB = gl_vb_create_for_immediate( ctx ); if (!ctx->VB) { - GL_FREE( ctx ); + FREE( ctx ); return NULL; } ctx->input = ctx->VB->IM; ctx->PB = gl_alloc_pb(); if (!ctx->PB) { - GL_FREE( ctx->VB ); - GL_FREE( ctx ); + FREE( ctx->VB ); + FREE( ctx ); return NULL; } @@ -1281,9 +1281,9 @@ GLcontext *gl_create_context( GLvisual *visual, /* allocate new group of display lists */ ctx->Shared = alloc_shared_state(); if (!ctx->Shared) { - GL_FREE(ctx->VB); - GL_FREE(ctx->PB); - GL_FREE(ctx); + FREE(ctx->VB); + FREE(ctx->PB); + FREE(ctx); return NULL; } } @@ -1294,11 +1294,11 @@ GLcontext *gl_create_context( GLvisual *visual, gl_reset_input( ctx ); - ctx->ShineTabList = GL_ALLOC_STRUCT( gl_shine_tab ); + ctx->ShineTabList = MALLOC_STRUCT( gl_shine_tab ); make_empty_list( ctx->ShineTabList ); for (i = 0 ; i < 10 ; i++) { - struct gl_shine_tab *s = GL_ALLOC_STRUCT( gl_shine_tab ); + struct gl_shine_tab *s = MALLOC_STRUCT( gl_shine_tab ); s->shininess = -1; s->refcount = 0; insert_at_tail( ctx->ShineTabList, s ); @@ -1340,9 +1340,9 @@ GLcontext *gl_create_context( GLvisual *visual, #ifdef GL_VERSION_1_1 if (!alloc_proxy_textures(ctx)) { free_shared_state(ctx, ctx->Shared); - GL_FREE(ctx->VB); - GL_FREE(ctx->PB); - GL_FREE(ctx); + FREE(ctx->VB); + FREE(ctx->PB); + FREE(ctx); return NULL; } #endif @@ -1388,7 +1388,7 @@ void gl_destroy_context( GLcontext *ctx ) gl_matrix_dtr( &ctx->ProjectionStack[i] ); } - GL_FREE( ctx->PB ); + FREE( ctx->PB ); if(ctx->input != ctx->VB->IM) gl_immediate_free( ctx->input ); @@ -1403,9 +1403,9 @@ void gl_destroy_context( GLcontext *ctx ) } foreach_s( s, tmps, ctx->ShineTabList ) { - GL_FREE( s ); + FREE( s ); } - GL_FREE( ctx->ShineTabList ); + FREE( ctx->ShineTabList ); /* Free proxy texture objects */ gl_free_texture_object( NULL, ctx->Texture.Proxy1D ); @@ -1414,52 +1414,52 @@ void gl_destroy_context( GLcontext *ctx ) /* Free evaluator data */ if (ctx->EvalMap.Map1Vertex3.Points) - GL_FREE( ctx->EvalMap.Map1Vertex3.Points ); + FREE( ctx->EvalMap.Map1Vertex3.Points ); if (ctx->EvalMap.Map1Vertex4.Points) - GL_FREE( ctx->EvalMap.Map1Vertex4.Points ); + FREE( ctx->EvalMap.Map1Vertex4.Points ); if (ctx->EvalMap.Map1Index.Points) - GL_FREE( ctx->EvalMap.Map1Index.Points ); + FREE( ctx->EvalMap.Map1Index.Points ); if (ctx->EvalMap.Map1Color4.Points) - GL_FREE( ctx->EvalMap.Map1Color4.Points ); + FREE( ctx->EvalMap.Map1Color4.Points ); if (ctx->EvalMap.Map1Normal.Points) - GL_FREE( ctx->EvalMap.Map1Normal.Points ); + FREE( ctx->EvalMap.Map1Normal.Points ); if (ctx->EvalMap.Map1Texture1.Points) - GL_FREE( ctx->EvalMap.Map1Texture1.Points ); + FREE( ctx->EvalMap.Map1Texture1.Points ); if (ctx->EvalMap.Map1Texture2.Points) - GL_FREE( ctx->EvalMap.Map1Texture2.Points ); + FREE( ctx->EvalMap.Map1Texture2.Points ); if (ctx->EvalMap.Map1Texture3.Points) - GL_FREE( ctx->EvalMap.Map1Texture3.Points ); + FREE( ctx->EvalMap.Map1Texture3.Points ); if (ctx->EvalMap.Map1Texture4.Points) - GL_FREE( ctx->EvalMap.Map1Texture4.Points ); + FREE( ctx->EvalMap.Map1Texture4.Points ); if (ctx->EvalMap.Map2Vertex3.Points) - GL_FREE( ctx->EvalMap.Map2Vertex3.Points ); + FREE( ctx->EvalMap.Map2Vertex3.Points ); if (ctx->EvalMap.Map2Vertex4.Points) - GL_FREE( ctx->EvalMap.Map2Vertex4.Points ); + FREE( ctx->EvalMap.Map2Vertex4.Points ); if (ctx->EvalMap.Map2Index.Points) - GL_FREE( ctx->EvalMap.Map2Index.Points ); + FREE( ctx->EvalMap.Map2Index.Points ); if (ctx->EvalMap.Map2Color4.Points) - GL_FREE( ctx->EvalMap.Map2Color4.Points ); + FREE( ctx->EvalMap.Map2Color4.Points ); if (ctx->EvalMap.Map2Normal.Points) - GL_FREE( ctx->EvalMap.Map2Normal.Points ); + FREE( ctx->EvalMap.Map2Normal.Points ); if (ctx->EvalMap.Map2Texture1.Points) - GL_FREE( ctx->EvalMap.Map2Texture1.Points ); + FREE( ctx->EvalMap.Map2Texture1.Points ); if (ctx->EvalMap.Map2Texture2.Points) - GL_FREE( ctx->EvalMap.Map2Texture2.Points ); + FREE( ctx->EvalMap.Map2Texture2.Points ); if (ctx->EvalMap.Map2Texture3.Points) - GL_FREE( ctx->EvalMap.Map2Texture3.Points ); + FREE( ctx->EvalMap.Map2Texture3.Points ); if (ctx->EvalMap.Map2Texture4.Points) - GL_FREE( ctx->EvalMap.Map2Texture4.Points ); + FREE( ctx->EvalMap.Map2Texture4.Points ); /* Free cache of immediate buffers. */ while (ctx->nr_im_queued-- > 0) { struct immediate * next = ctx->freed_im_queue->next; - GL_FREE( ctx->freed_im_queue ); + FREE( ctx->freed_im_queue ); ctx->freed_im_queue = next; } gl_extensions_dtr(ctx); - GL_FREE( (void *) ctx ); + FREE( (void *) ctx ); #ifndef THREADS if (ctx==CC) { @@ -1484,7 +1484,7 @@ GLframebuffer *gl_create_framebuffer( GLvisual *visual ) { GLframebuffer *buffer; - buffer = (GLframebuffer *) GL_CALLOC( sizeof(GLframebuffer) ); + buffer = (GLframebuffer *) CALLOC( sizeof(GLframebuffer) ); if (!buffer) { return NULL; } @@ -1503,27 +1503,27 @@ void gl_destroy_framebuffer( GLframebuffer *buffer ) { if (buffer) { if (buffer->Depth) { - GL_FREE( buffer->Depth ); + FREE( buffer->Depth ); } if (buffer->Accum) { - GL_FREE( buffer->Accum ); + FREE( buffer->Accum ); } if (buffer->Stencil) { - GL_FREE( buffer->Stencil ); + FREE( buffer->Stencil ); } if (buffer->FrontLeftAlpha) { - GL_FREE( buffer->FrontLeftAlpha ); + FREE( buffer->FrontLeftAlpha ); } if (buffer->BackLeftAlpha) { - GL_FREE( buffer->BackLeftAlpha ); + FREE( buffer->BackLeftAlpha ); } if (buffer->FrontRightAlpha) { - GL_FREE( buffer->FrontRightAlpha ); + FREE( buffer->FrontRightAlpha ); } if (buffer->BackRightAlpha) { - GL_FREE( buffer->BackRightAlpha ); + FREE( buffer->BackRightAlpha ); } - GL_FREE(buffer); + FREE(buffer); } } diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index c0279f4a844..e3dbf77b85e 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -1,4 +1,4 @@ -/* $Id: depth.c,v 1.6 1999/10/11 04:22:11 joukj Exp $ */ +/* $Id: depth.c,v 1.7 1999/10/13 18:42:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -812,12 +812,12 @@ void gl_alloc_depth_buffer( GLcontext* ctx ) { /* deallocate current depth buffer if present */ if (ctx->Buffer->Depth) { - GL_FREE(ctx->Buffer->Depth); + FREE(ctx->Buffer->Depth); ctx->Buffer->Depth = NULL; } /* allocate new depth buffer, but don't initialize it */ - ctx->Buffer->Depth = (GLdepth *) GL_ALLOC( ctx->Buffer->Width + ctx->Buffer->Depth = (GLdepth *) MALLOC( 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 ec36bd4a281..15ca3d9a452 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.8 1999/10/10 12:51:29 brianp Exp $ */ +/* $Id: dlist.c,v 1.9 1999/10/13 18:42:50 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 *) GL_ALLOC( sizeof(Node) * BLOCK_SIZE ); + newblock = (Node *) MALLOC( 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 *) GL_ALLOC( sizeof(Node) ); + Node *n = (Node *) MALLOC( 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: - GL_FREE( n[1].data ); + 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; - GL_FREE( block ); + FREE( block ); block = n; break; case OPCODE_END_OF_LIST: - GL_FREE( block ); + 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 *) GL_ALLOC( mapsize * sizeof(GLfloat) ); + n[3].data = (void *) MALLOC( 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 = GL_ALLOC( 32 * 4 ); + n[1].data = MALLOC( 32 * 4 ); data = n[1].data; /* This needed for Acorn compiler */ MEMCPY( data, pattern, 32 * 4 ); } @@ -2388,7 +2388,7 @@ void gl_compile_cassette( GLcontext *ctx ) if (!n || !new_im) { if (n) - GL_FREE(n); + FREE(n); if (new_im) gl_immediate_free(new_im); return; @@ -2397,7 +2397,7 @@ void gl_compile_cassette( GLcontext *ctx ) /* Do some easy optimizations of the cassette. */ if (im->v.Obj.size < 4 && im->Count > 15) { - im->Bounds = (GLfloat (*)[3]) GL_ALLOC(6 * sizeof(GLfloat)); + im->Bounds = (GLfloat (*)[3]) MALLOC(6 * sizeof(GLfloat)); (gl_calc_bound_tab[im->v.Obj.size])( im->Bounds, &im->v.Obj ); } @@ -3038,7 +3038,7 @@ void gl_NewList( GLcontext *ctx, GLuint list, GLenum mode ) /* Allocate new display list */ ctx->CurrentListNum = list; - ctx->CurrentBlock = (Node *) GL_ALLOC( sizeof(Node) * BLOCK_SIZE ); + ctx->CurrentBlock = (Node *) MALLOC( sizeof(Node) * BLOCK_SIZE ); ctx->CurrentListPtr = ctx->CurrentBlock; ctx->CurrentPos = 0; @@ -3089,7 +3089,7 @@ void gl_EndList( GLcontext *ctx ) /* KW: Put back the old input pointer. */ - GL_FREE( ctx->input ); + 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 ab94f506152..b1b40a95cad 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -1,4 +1,4 @@ -/* $Id: enums.c,v 1.2 1999/10/10 12:51:29 brianp Exp $ */ +/* $Id: enums.c,v 1.3 1999/10/13 18:42:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -825,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 **)GL_ALLOC( Elements(all_enums) * sizeof(enum_elt *) ); + index1 = (enum_elt **)MALLOC( 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 f391b80407b..18676e73add 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -1,4 +1,4 @@ -/* $Id: eval.c,v 1.3 1999/10/10 12:54:04 brianp Exp $ */ +/* $Id: eval.c,v 1.4 1999/10/13 18:42:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -582,7 +582,7 @@ GLfloat *gl_copy_map_points1f( GLenum target, return NULL; } - buffer = (GLfloat *) GL_ALLOC(uorder * size * sizeof(GLfloat)); + buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat)); if(buffer) for(i=0, p=buffer; i<uorder; i++, points+=ustride) @@ -608,7 +608,7 @@ GLfloat *gl_copy_map_points1d( GLenum target, return NULL; } - buffer = (GLfloat *) GL_ALLOC(uorder * size * sizeof(GLfloat)); + buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat)); if(buffer) for(i=0, p=buffer; i<uorder; i++, points+=ustride) @@ -652,9 +652,9 @@ GLfloat *gl_copy_map_points2f( GLenum target, hsize = (uorder > vorder ? uorder : vorder)*size; if(hsize>dsize) - buffer = (GLfloat *) GL_ALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat)); + buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat)); else - buffer = (GLfloat *) GL_ALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat)); + buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat)); /* compute the increment value for the u-loop */ uinc = ustride - vorder*vstride; @@ -695,9 +695,9 @@ GLfloat *gl_copy_map_points2d(GLenum target, hsize = (uorder > vorder ? uorder : vorder)*size; if(hsize>dsize) - buffer = (GLfloat *) GL_ALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat)); + buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat)); else - buffer = (GLfloat *) GL_ALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat)); + buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat)); /* compute the increment value for the u-loop */ uinc = ustride - vorder*vstride; @@ -790,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. */ - GL_FREE( data ); + FREE( data ); } } if (map2) { @@ -802,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. */ - GL_FREE( data ); + FREE( data ); } } @@ -864,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) { - GL_FREE( ctx->EvalMap.Map1Vertex3.Points ); + FREE( ctx->EvalMap.Map1Vertex3.Points ); } ctx->EvalMap.Map1Vertex3.Points = (GLfloat *) points; ctx->EvalMap.Map1Vertex3.Retain = retain; @@ -876,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) { - GL_FREE( ctx->EvalMap.Map1Vertex4.Points ); + FREE( ctx->EvalMap.Map1Vertex4.Points ); } ctx->EvalMap.Map1Vertex4.Points = (GLfloat *) points; ctx->EvalMap.Map1Vertex4.Retain = retain; @@ -888,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) { - GL_FREE( ctx->EvalMap.Map1Index.Points ); + FREE( ctx->EvalMap.Map1Index.Points ); } ctx->EvalMap.Map1Index.Points = (GLfloat *) points; ctx->EvalMap.Map1Index.Retain = retain; @@ -900,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) { - GL_FREE( ctx->EvalMap.Map1Color4.Points ); + FREE( ctx->EvalMap.Map1Color4.Points ); } ctx->EvalMap.Map1Color4.Points = (GLfloat *) points; ctx->EvalMap.Map1Color4.Retain = retain; @@ -912,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) { - GL_FREE( ctx->EvalMap.Map1Normal.Points ); + FREE( ctx->EvalMap.Map1Normal.Points ); } ctx->EvalMap.Map1Normal.Points = (GLfloat *) points; ctx->EvalMap.Map1Normal.Retain = retain; @@ -924,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) { - GL_FREE( ctx->EvalMap.Map1Texture1.Points ); + FREE( ctx->EvalMap.Map1Texture1.Points ); } ctx->EvalMap.Map1Texture1.Points = (GLfloat *) points; ctx->EvalMap.Map1Texture1.Retain = retain; @@ -936,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) { - GL_FREE( ctx->EvalMap.Map1Texture2.Points ); + FREE( ctx->EvalMap.Map1Texture2.Points ); } ctx->EvalMap.Map1Texture2.Points = (GLfloat *) points; ctx->EvalMap.Map1Texture2.Retain = retain; @@ -948,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) { - GL_FREE( ctx->EvalMap.Map1Texture3.Points ); + FREE( ctx->EvalMap.Map1Texture3.Points ); } ctx->EvalMap.Map1Texture3.Points = (GLfloat *) points; ctx->EvalMap.Map1Texture3.Retain = retain; @@ -960,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) { - GL_FREE( ctx->EvalMap.Map1Texture4.Points ); + FREE( ctx->EvalMap.Map1Texture4.Points ); } ctx->EvalMap.Map1Texture4.Points = (GLfloat *) points; ctx->EvalMap.Map1Texture4.Retain = retain; @@ -1033,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) { - GL_FREE( ctx->EvalMap.Map2Vertex3.Points ); + FREE( ctx->EvalMap.Map2Vertex3.Points ); } ctx->EvalMap.Map2Vertex3.Retain = retain; ctx->EvalMap.Map2Vertex3.Points = (GLfloat *) points; @@ -1049,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) { - GL_FREE( ctx->EvalMap.Map2Vertex4.Points ); + FREE( ctx->EvalMap.Map2Vertex4.Points ); } ctx->EvalMap.Map2Vertex4.Points = (GLfloat *) points; ctx->EvalMap.Map2Vertex4.Retain = retain; @@ -1065,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) { - GL_FREE( ctx->EvalMap.Map2Index.Points ); + FREE( ctx->EvalMap.Map2Index.Points ); } ctx->EvalMap.Map2Index.Retain = retain; ctx->EvalMap.Map2Index.Points = (GLfloat *) points; @@ -1081,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) { - GL_FREE( ctx->EvalMap.Map2Color4.Points ); + FREE( ctx->EvalMap.Map2Color4.Points ); } ctx->EvalMap.Map2Color4.Retain = retain; ctx->EvalMap.Map2Color4.Points = (GLfloat *) points; @@ -1097,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) { - GL_FREE( ctx->EvalMap.Map2Normal.Points ); + FREE( ctx->EvalMap.Map2Normal.Points ); } ctx->EvalMap.Map2Normal.Retain = retain; ctx->EvalMap.Map2Normal.Points = (GLfloat *) points; @@ -1113,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) { - GL_FREE( ctx->EvalMap.Map2Texture1.Points ); + FREE( ctx->EvalMap.Map2Texture1.Points ); } ctx->EvalMap.Map2Texture1.Retain = retain; ctx->EvalMap.Map2Texture1.Points = (GLfloat *) points; @@ -1129,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) { - GL_FREE( ctx->EvalMap.Map2Texture2.Points ); + FREE( ctx->EvalMap.Map2Texture2.Points ); } ctx->EvalMap.Map2Texture2.Retain = retain; ctx->EvalMap.Map2Texture2.Points = (GLfloat *) points; @@ -1145,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) { - GL_FREE( ctx->EvalMap.Map2Texture3.Points ); + FREE( ctx->EvalMap.Map2Texture3.Points ); } ctx->EvalMap.Map2Texture3.Retain = retain; ctx->EvalMap.Map2Texture3.Points = (GLfloat *) points; @@ -1161,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) { - GL_FREE( ctx->EvalMap.Map2Texture4.Points ); + FREE( ctx->EvalMap.Map2Texture4.Points ); } ctx->EvalMap.Map2Texture4.Retain = retain; ctx->EvalMap.Map2Texture4.Points = (GLfloat *) points; @@ -2557,7 +2557,7 @@ void gl_eval_vb( struct vertex_buffer *VB ) GLuint count = VB->Count; if (!flags) { - VB->EvaluatedFlags = (GLuint *) GL_ALLOC(VB->Size * sizeof(GLuint)); + VB->EvaluatedFlags = (GLuint *) MALLOC(VB->Size * sizeof(GLuint)); flags = VB->Flag = VB->EvaluatedFlags; } diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 08d524f3519..c1c29c47351 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.6 1999/10/10 12:54:04 brianp Exp $ */ +/* $Id: extensions.c,v 1.7 1999/10/13 18:42:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -82,7 +82,7 @@ int gl_extensions_add( GLcontext *ctx, if (ctx->Extensions.ext_string == 0) { - struct extension *t = GL_ALLOC_STRUCT(extension); + struct extension *t = MALLOC_STRUCT(extension); t->enabled = state; strncpy(t->name, name, MAX_EXT_NAMELEN); t->name[MAX_EXT_NAMELEN] = 0; @@ -134,17 +134,17 @@ void gl_extensions_dtr( GLcontext *ctx ) struct extension *i, *nexti; if (ctx->Extensions.ext_string) { - GL_FREE( ctx->Extensions.ext_string ); + 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 ); - GL_FREE( i ); + FREE( i ); } - GL_FREE(ctx->Extensions.ext_list); + FREE(ctx->Extensions.ext_list); ctx->Extensions.ext_list = 0; } } @@ -155,7 +155,7 @@ void gl_extensions_ctr( GLcontext *ctx ) GLuint i; ctx->Extensions.ext_string = 0; - ctx->Extensions.ext_list = GL_ALLOC_STRUCT(extension); + ctx->Extensions.ext_list = MALLOC_STRUCT(extension); make_empty_list( ctx->Extensions.ext_list ); for (i = 0 ; i < Elements(default_extensions) ; i++) { @@ -181,7 +181,7 @@ const char *gl_extensions_get_string( GLcontext *ctx ) if (len == 0) return ""; - str = (char *)GL_ALLOC(len * sizeof(char)); + str = (char *)MALLOC(len * sizeof(char)); ctx->Extensions.ext_string = str; foreach (i, ctx->Extensions.ext_list) diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index ce5fdee9316..0b0eabfb102 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -1,4 +1,4 @@ -/* $Id: hash.c,v 1.2 1999/10/08 09:27:10 keithw Exp $ */ +/* $Id: hash.c,v 1.3 1999/10/13 18:42:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -26,8 +26,6 @@ - - #ifdef PC_HEADER #include "all.h" #else @@ -39,6 +37,7 @@ #include "GL/xf86glx.h" #endif #include "hash.h" +#include "macros.h" #endif @@ -70,7 +69,7 @@ struct HashTable { */ struct HashTable *NewHashTable(void) { - return (struct HashTable *) calloc(sizeof (struct HashTable), 1); + return CALLOC_STRUCT(HashTable); } @@ -86,11 +85,11 @@ void DeleteHashTable(struct HashTable *table) struct HashEntry *entry = table->Table[i]; while (entry) { struct HashEntry *next = entry->Next; - free(entry); + FREE(entry); entry = next; } } - free(table); + FREE(table); } @@ -153,7 +152,7 @@ void HashInsert(struct HashTable *table, GLuint key, void *data) } /* alloc and insert new table entry */ - entry = (struct HashEntry *) calloc(sizeof(struct HashEntry), 1); + entry = MALLOC_STRUCT(HashEntry); entry->Key = key; entry->Data = data; entry->Next = table->Table[pos]; @@ -187,7 +186,7 @@ void HashRemove(struct HashTable *table, GLuint key) else { table->Table[pos] = entry->Next; } - free(entry); + FREE(entry); return; } prev = entry; diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 781efad855a..8eaa328152a 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.5 1999/10/10 13:04:17 brianp Exp $ */ +/* $Id: image.c,v 1.6 1999/10/13 18:42:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -483,7 +483,7 @@ GLvoid *gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing, */ static struct gl_image *alloc_image( void ) { - return GL_CALLOC_STRUCT(gl_image); + return CALLOC_STRUCT(gl_image); } @@ -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) { - GL_FREE(image->Data); + FREE(image->Data); } - GL_FREE(image); + 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 = GL_ALLOC( width * height * sizeof(GLushort)); + image->Data = MALLOC( width * height * sizeof(GLushort)); } else if (type==GL_UNSIGNED_INT) { image->Type = GL_UNSIGNED_INT; - image->Data = GL_ALLOC( width * height * sizeof(GLuint)); + image->Data = MALLOC( width * height * sizeof(GLuint)); } else { image->Type = GL_FLOAT; - image->Data = GL_ALLOC( width * height * sizeof(GLfloat)); + image->Data = MALLOC( 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 = GL_ALLOC( width * height * sizeof(GLubyte)); + image->Data = MALLOC( 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 *) GL_ALLOC( bytes ); + buffer = (GLubyte *) MALLOC( 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) { - GL_FREE(buffer); + 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 { - GL_FREE( buffer ); + 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 *) GL_ALLOC( height * width_in_bytes * depth ); + buffer = (GLubyte *) MALLOC( 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) { - GL_FREE(buffer); + 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 { - GL_FREE( buffer ); + 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 = GL_ALLOC( elems_per_row * height * depth * sizeof(GLfloat)); + image->Data = MALLOC( elems_per_row * height * depth * sizeof(GLfloat)); image->RefCount = 0; if (!image->Data) return image; diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 8c4f8738a96..a9443c5c603 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -1,4 +1,4 @@ -/* $Id: macros.h,v 1.4 1999/10/11 04:22:57 joukj Exp $ */ +/* $Id: macros.h,v 1.5 1999/10/13 18:42:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -485,20 +485,20 @@ do { \ * XXX these should probably go into a new glmemory.h file. */ #ifdef DEBUG -extern void *gl_alloc(size_t bytes); +extern void *gl_malloc(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) +#define MALLOC(BYTES) gl_malloc(BYTES) +#define CALLOC(BYTES) gl_calloc(BYTES) +#define MALLOC_STRUCT(T) (struct T *) gl_malloc(sizeof(struct T)) +#define CALLOC_STRUCT(T) (struct T *) gl_calloc(sizeof(struct T)) +#define 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(1,sizeof(struct T)) -#define GL_FREE(PTR) free(PTR) +#define MALLOC(BYTES) (void *) malloc(BYTES) +#define CALLOC(BYTES) (void *) calloc(1, BYTES) +#define MALLOC_STRUCT(T) (struct T *) malloc(sizeof(struct T)) +#define CALLOC_STRUCT(T) (struct T *) calloc(1,sizeof(struct T)) +#define FREE(PTR) free(PTR) #endif diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index a5b080e2bd4..ebf55c37c8d 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -1,4 +1,4 @@ -/* $Id: matrix.c,v 1.6 1999/10/10 12:56:45 brianp Exp $ */ +/* $Id: matrix.c,v 1.7 1999/10/13 18:42:50 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) { - GL_FREE(m->inv); + 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 *)GL_ALLOC(16*sizeof(GLfloat)); + m->inv = (GLfloat *)MALLOC(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 3868a803cbb..e3529996be7 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -1,4 +1,4 @@ -/* $Id: stencil.c,v 1.5 1999/10/10 12:56:45 brianp Exp $ */ +/* $Id: stencil.c,v 1.6 1999/10/13 18:42:50 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) { - GL_FREE(ctx->Buffer->Stencil); + FREE(ctx->Buffer->Stencil); ctx->Buffer->Stencil = NULL; } /* allocate new stencil buffer */ - ctx->Buffer->Stencil = (GLstencil *) GL_ALLOC(buffersize * sizeof(GLstencil)); + ctx->Buffer->Stencil = (GLstencil *) MALLOC(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 f6ef4238646..1346e3d0679 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $Id: teximage.c,v 1.3 1999/10/10 12:56:45 brianp Exp $ */ +/* $Id: teximage.c,v 1.4 1999/10/13 18:42:50 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 GL_CALLOC_STRUCT(gl_texture_image); + return 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) { - GL_FREE( teximage->Data ); + FREE( teximage->Data ); } - GL_FREE( teximage ); + 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 *) GL_ALLOC( numPixels * components + EXTRA_BYTE ); + texImage->Data = (GLubyte *) MALLOC( 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 *) GL_ALLOC( numPixels * components + EXTRA_BYTE ); + texImage->Data = (GLubyte *) MALLOC( 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 = GL_ALLOC_STRUCT( gl_image ); + image = MALLOC_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 *) GL_ALLOC( width * height * components ); + image->Data = (GLubyte *) MALLOC( width * height * components ); if (!image->Data) { - GL_FREE(image); + FREE(image); return NULL; } } diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index e46b318a44b..60a142ea5bc 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1,4 +1,4 @@ -/* $Id: texobj.c,v 1.5 1999/10/10 13:04:17 brianp Exp $ */ +/* $Id: texobj.c,v 1.6 1999/10/13 18:42:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -159,7 +159,7 @@ void gl_free_texture_object( struct gl_shared_state *shared, } } /* free this object */ - GL_FREE( t ); + FREE( t ); } |