diff options
Diffstat (limited to 'src/mesa/main')
31 files changed, 197 insertions, 227 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index e36137d3782..3a1fd37324b 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -130,7 +130,7 @@ _mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj ) (void) ctx; unbind_array_object_vbos(ctx, obj); _glthread_DESTROY_MUTEX(obj->Mutex); - _mesa_free(obj); + free(obj); } diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 44dc3b871ec..9a32bc335d4 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1559,8 +1559,8 @@ _mesa_free_attrib_data(GLcontext *ctx) } next = attr->next; - _mesa_free(attr->data); - _mesa_free(attr); + free(attr->data); + free(attr); attr = next; } } diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 2e9793ea0e5..816465cea18 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -208,14 +208,14 @@ _mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) (void) ctx; if (bufObj->Data) - _mesa_free(bufObj->Data); + free(bufObj->Data); /* assign strange values here to help w/ debugging */ bufObj->RefCount = -1000; bufObj->Name = ~0; _glthread_DESTROY_MUTEX(bufObj->Mutex); - _mesa_free(bufObj); + free(bufObj); } diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 1c12fb00fab..785813166c5 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -407,8 +407,8 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, _mesa_free_colortable_data(table); if (width > 0) { - table->TableF = (GLfloat *) _mesa_malloc(comps * width * sizeof(GLfloat)); - table->TableUB = (GLubyte *) _mesa_malloc(comps * width * sizeof(GLubyte)); + table->TableF = (GLfloat *) malloc(comps * width * sizeof(GLfloat)); + table->TableUB = (GLubyte *) malloc(comps * width * sizeof(GLubyte)); if (!table->TableF || !table->TableUB) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorTable"); @@ -1095,11 +1095,11 @@ void _mesa_free_colortable_data( struct gl_color_table *p ) { if (p->TableF) { - _mesa_free(p->TableF); + free(p->TableF); p->TableF = NULL; } if (p->TableUB) { - _mesa_free(p->TableUB); + free(p->TableUB); p->TableUB = NULL; } } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index f315f0b212b..4ecbb5ecf66 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -222,7 +222,7 @@ _mesa_create_visual( GLboolean rgbFlag, GLint accumAlphaBits, GLint numSamples ) { - GLvisual *vis = (GLvisual *) _mesa_calloc(sizeof(GLvisual)); + GLvisual *vis = (GLvisual *) calloc(1, sizeof(GLvisual)); if (vis) { if (!_mesa_initialize_visual(vis, rgbFlag, dbFlag, stereoFlag, redBits, greenBits, blueBits, alphaBits, @@ -230,7 +230,7 @@ _mesa_create_visual( GLboolean rgbFlag, accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits, numSamples)) { - _mesa_free(vis); + free(vis); return NULL; } } @@ -320,7 +320,7 @@ _mesa_initialize_visual( GLvisual *vis, void _mesa_destroy_visual( GLvisual *vis ) { - _mesa_free(vis); + free(vis); } /*@}*/ @@ -755,7 +755,7 @@ alloc_dispatch_table(void) GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), sizeof(struct _glapi_table) / sizeof(_glapi_proc)); struct _glapi_table *table = - (struct _glapi_table *) _mesa_malloc(numEntries * sizeof(_glapi_proc)); + (struct _glapi_table *) malloc(numEntries * sizeof(_glapi_proc)); if (table) { _glapi_proc *entry = (_glapi_proc *) table; GLint i; @@ -850,7 +850,7 @@ _mesa_initialize_context(GLcontext *ctx, if (!ctx->Exec || !ctx->Save) { _mesa_release_shared_state(ctx, ctx->Shared); if (ctx->Exec) - _mesa_free(ctx->Exec); + free(ctx->Exec); return GL_FALSE; } #if FEATURE_dispatch @@ -913,7 +913,7 @@ _mesa_create_context(const GLvisual *visual, ASSERT(visual); /*ASSERT(driverContext);*/ - ctx = (GLcontext *) _mesa_calloc(sizeof(GLcontext)); + ctx = (GLcontext *) calloc(1, sizeof(GLcontext)); if (!ctx) return NULL; @@ -922,7 +922,7 @@ _mesa_create_context(const GLvisual *visual, return ctx; } else { - _mesa_free(ctx); + free(ctx); return NULL; } } @@ -989,8 +989,8 @@ _mesa_free_context_data( GLcontext *ctx ) #endif /* free dispatch tables */ - _mesa_free(ctx->Exec); - _mesa_free(ctx->Save); + free(ctx->Exec); + free(ctx->Save); /* Shared context state (display lists, textures, etc) */ _mesa_release_shared_state( ctx, ctx->Shared ); @@ -999,10 +999,10 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_display_list_data(ctx); if (ctx->Extensions.String) - _mesa_free((void *) ctx->Extensions.String); + free((void *) ctx->Extensions.String); if (ctx->VersionString) - _mesa_free(ctx->VersionString); + free(ctx->VersionString); /* unbind the context if it's currently bound */ if (ctx == _mesa_get_current_context()) { @@ -1023,7 +1023,7 @@ _mesa_destroy_context( GLcontext *ctx ) { if (ctx) { _mesa_free_context_data(ctx); - _mesa_free( (void *) ctx ); + free( (void *) ctx ); } } diff --git a/src/mesa/main/cpuinfo.c b/src/mesa/main/cpuinfo.c index 79fcbc71c29..35de69b180f 100644 --- a/src/mesa/main/cpuinfo.c +++ b/src/mesa/main/cpuinfo.c @@ -43,7 +43,7 @@ _mesa_get_cpu_features(void) /** * Return a string describing the CPU architexture and extensions that * Mesa is using (such as SSE or Altivec). - * \return information string, free it with _mesa_free() + * \return information string, free it with free() */ char * _mesa_get_cpu_string(void) @@ -51,7 +51,7 @@ _mesa_get_cpu_string(void) #define MAX_STRING 50 char *buffer; - buffer = (char *) _mesa_malloc(MAX_STRING); + buffer = (char *) malloc(MAX_STRING); if (!buffer) return NULL; diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index f2182c05777..79b63e940fa 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -303,7 +303,7 @@ write_texture_image(struct gl_texture_object *texObj, GLubyte *buffer; char s[100]; - buffer = (GLubyte *) _mesa_malloc(img->Width * img->Height + buffer = (GLubyte *) malloc(img->Width * img->Height * img->Depth * 4); store = ctx->Pack; /* save */ @@ -321,7 +321,7 @@ write_texture_image(struct gl_texture_object *texObj, ctx->Pack = store; /* restore */ - _mesa_free(buffer); + free(buffer); } } @@ -350,7 +350,7 @@ write_renderbuffer_image(const struct gl_renderbuffer *rb) return; } - buffer = (GLubyte *) _mesa_malloc(rb->Width * rb->Height * 4); + buffer = (GLubyte *) malloc(rb->Width * rb->Height * 4); ctx->Driver.ReadPixels(ctx, 0, 0, rb->Width, rb->Height, format, type, &ctx->DefaultPacking, buffer); @@ -361,7 +361,7 @@ write_renderbuffer_image(const struct gl_renderbuffer *rb) _mesa_printf(" Writing renderbuffer image to %s\n", s); write_ppm(s, buffer, rb->Width, rb->Height, 4, 0, 1, 2, GL_TRUE); - _mesa_free(buffer); + free(buffer); } @@ -481,7 +481,7 @@ _mesa_dump_color_buffer(const char *filename) const GLuint h = ctx->DrawBuffer->Height; GLubyte *buf; - buf = (GLubyte *) _mesa_malloc(w * h * 4); + buf = (GLubyte *) malloc(w * h * 4); _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1); @@ -499,7 +499,7 @@ _mesa_dump_color_buffer(const char *filename) _mesa_PopClientAttrib(); - _mesa_free(buf); + free(buf); } @@ -513,8 +513,8 @@ _mesa_dump_depth_buffer(const char *filename) GLubyte *buf2; GLuint i; - buf = (GLuint *) _mesa_malloc(w * h * 4); /* 4 bpp */ - buf2 = (GLubyte *) _mesa_malloc(w * h * 3); /* 3 bpp */ + buf = (GLuint *) malloc(w * h * 4); /* 4 bpp */ + buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */ _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1); @@ -534,8 +534,8 @@ _mesa_dump_depth_buffer(const char *filename) _mesa_PopClientAttrib(); - _mesa_free(buf); - _mesa_free(buf2); + free(buf); + free(buf2); } @@ -549,8 +549,8 @@ _mesa_dump_stencil_buffer(const char *filename) GLubyte *buf2; GLuint i; - buf = (GLubyte *) _mesa_malloc(w * h); /* 1 bpp */ - buf2 = (GLubyte *) _mesa_malloc(w * h * 3); /* 3 bpp */ + buf = (GLubyte *) malloc(w * h); /* 1 bpp */ + buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */ _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1); @@ -569,8 +569,8 @@ _mesa_dump_stencil_buffer(const char *filename) _mesa_PopClientAttrib(); - _mesa_free(buf); - _mesa_free(buf2); + free(buf); + free(buf2); } diff --git a/src/mesa/main/depthstencil.c b/src/mesa/main/depthstencil.c index 49946a65062..892520b6959 100644 --- a/src/mesa/main/depthstencil.c +++ b/src/mesa/main/depthstencil.c @@ -65,7 +65,7 @@ delete_wrapper(struct gl_renderbuffer *rb) ASSERT(rb->Format == MESA_FORMAT_Z24_S8 || rb->Format == MESA_FORMAT_S8_Z24); _mesa_reference_renderbuffer(&rb->Wrapped, NULL); - _mesa_free(rb); + free(rb); } @@ -818,5 +818,5 @@ _mesa_promote_stencil(GLcontext *ctx, struct gl_renderbuffer *stencilRb) } stencilRb->PutRow(ctx, stencilRb, width, 0, i, depthStencil, NULL); } - _mesa_free(data); + free(data); } diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 740ebfe17a5..87b8ddacc2e 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -472,7 +472,7 @@ make_list(GLuint name, GLuint count) { struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list); dlist->Name = name; - dlist->Head = (Node *) _mesa_malloc(sizeof(Node) * count); + dlist->Head = (Node *) malloc(sizeof(Node) * count); dlist->Head[0].opcode = OPCODE_END_OF_LIST; return dlist; } @@ -557,108 +557,108 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) switch (opcode) { /* for some commands, we need to free malloc'd memory */ case OPCODE_MAP1: - _mesa_free(n[6].data); + free(n[6].data); n += InstSize[n[0].opcode]; break; case OPCODE_MAP2: - _mesa_free(n[10].data); + free(n[10].data); n += InstSize[n[0].opcode]; break; case OPCODE_DRAW_PIXELS: - _mesa_free(n[5].data); + free(n[5].data); n += InstSize[n[0].opcode]; break; case OPCODE_BITMAP: - _mesa_free(n[7].data); + free(n[7].data); n += InstSize[n[0].opcode]; break; case OPCODE_COLOR_TABLE: - _mesa_free(n[6].data); + free(n[6].data); n += InstSize[n[0].opcode]; break; case OPCODE_COLOR_SUB_TABLE: - _mesa_free(n[6].data); + free(n[6].data); n += InstSize[n[0].opcode]; break; case OPCODE_CONVOLUTION_FILTER_1D: - _mesa_free(n[6].data); + free(n[6].data); n += InstSize[n[0].opcode]; break; case OPCODE_CONVOLUTION_FILTER_2D: - _mesa_free(n[7].data); + free(n[7].data); n += InstSize[n[0].opcode]; break; case OPCODE_POLYGON_STIPPLE: - _mesa_free(n[1].data); + free(n[1].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_IMAGE1D: - _mesa_free(n[8].data); + free(n[8].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_IMAGE2D: - _mesa_free(n[9].data); + free(n[9].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_IMAGE3D: - _mesa_free(n[10].data); + free(n[10].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_SUB_IMAGE1D: - _mesa_free(n[7].data); + free(n[7].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_SUB_IMAGE2D: - _mesa_free(n[9].data); + free(n[9].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_SUB_IMAGE3D: - _mesa_free(n[11].data); + free(n[11].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_IMAGE_1D: - _mesa_free(n[7].data); + free(n[7].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_IMAGE_2D: - _mesa_free(n[8].data); + free(n[8].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_IMAGE_3D: - _mesa_free(n[9].data); + free(n[9].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: - _mesa_free(n[7].data); + free(n[7].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: - _mesa_free(n[9].data); + free(n[9].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: - _mesa_free(n[11].data); + free(n[11].data); n += InstSize[n[0].opcode]; break; #if FEATURE_NV_vertex_program case OPCODE_LOAD_PROGRAM_NV: - _mesa_free(n[4].data); /* program string */ + free(n[4].data); /* program string */ n += InstSize[n[0].opcode]; break; case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV: - _mesa_free(n[2].data); /* array of program ids */ + free(n[2].data); /* array of program ids */ n += InstSize[n[0].opcode]; break; #endif #if FEATURE_NV_fragment_program case OPCODE_PROGRAM_NAMED_PARAMETER_NV: - _mesa_free(n[3].data); /* parameter name */ + free(n[3].data); /* parameter name */ n += InstSize[n[0].opcode]; break; #endif #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program case OPCODE_PROGRAM_STRING_ARB: - _mesa_free(n[4].data); /* program string */ + free(n[4].data); /* program string */ n += InstSize[n[0].opcode]; break; #endif @@ -670,7 +670,7 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) case OPCODE_UNIFORM_2IV: case OPCODE_UNIFORM_3IV: case OPCODE_UNIFORM_4IV: - _mesa_free(n[3].data); + free(n[3].data); n += InstSize[n[0].opcode]; break; case OPCODE_UNIFORM_MATRIX22: @@ -682,17 +682,17 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) case OPCODE_UNIFORM_MATRIX32: case OPCODE_UNIFORM_MATRIX34: case OPCODE_UNIFORM_MATRIX43: - _mesa_free(n[4].data); + free(n[4].data); n += InstSize[n[0].opcode]; break; case OPCODE_CONTINUE: n = (Node *) n[1].next; - _mesa_free(block); + free(block); block = n; break; case OPCODE_END_OF_LIST: - _mesa_free(block); + free(block); done = GL_TRUE; break; default: @@ -703,7 +703,7 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) } } - _mesa_free(dlist); + free(dlist); } @@ -869,7 +869,7 @@ dlist_alloc(GLcontext *ctx, OpCode opcode, GLuint bytes) Node *newblock; n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos; n[0].opcode = OPCODE_CONTINUE; - newblock = (Node *) _mesa_malloc(sizeof(Node) * BLOCK_SIZE); + newblock = (Node *) malloc(sizeof(Node) * BLOCK_SIZE); if (!newblock) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list"); return NULL; @@ -2912,7 +2912,7 @@ save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values) if (n) { n[1].e = map; n[2].i = mapsize; - n[3].data = (void *) _mesa_malloc(mapsize * sizeof(GLfloat)); + n[3].data = (void *) malloc(mapsize * sizeof(GLfloat)); memcpy(n[3].data, (void *) values, mapsize * sizeof(GLfloat)); } if (ctx->ExecuteFlag) { @@ -4360,7 +4360,7 @@ save_CompressedTexImage1DARB(GLenum target, GLint level, GLvoid *image; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ - image = _mesa_malloc(imageSize); + image = malloc(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB"); return; @@ -4377,7 +4377,7 @@ save_CompressedTexImage1DARB(GLenum target, GLint level, n[7].data = image; } else if (image) { - _mesa_free(image); + free(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexImage1DARB(ctx->Exec, @@ -4406,7 +4406,7 @@ save_CompressedTexImage2DARB(GLenum target, GLint level, GLvoid *image; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ - image = _mesa_malloc(imageSize); + image = malloc(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); return; @@ -4424,7 +4424,7 @@ save_CompressedTexImage2DARB(GLenum target, GLint level, n[8].data = image; } else if (image) { - _mesa_free(image); + free(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexImage2DARB(ctx->Exec, @@ -4453,7 +4453,7 @@ save_CompressedTexImage3DARB(GLenum target, GLint level, GLvoid *image; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ - image = _mesa_malloc(imageSize); + image = malloc(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB"); return; @@ -4472,7 +4472,7 @@ save_CompressedTexImage3DARB(GLenum target, GLint level, n[9].data = image; } else if (image) { - _mesa_free(image); + free(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexImage3DARB(ctx->Exec, @@ -4496,7 +4496,7 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ - image = _mesa_malloc(imageSize); + image = malloc(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB"); return; @@ -4513,7 +4513,7 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, n[7].data = image; } else if (image) { - _mesa_free(image); + free(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexSubImage1DARB(ctx->Exec, (target, level, xoffset, @@ -4536,7 +4536,7 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ - image = _mesa_malloc(imageSize); + image = malloc(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB"); return; @@ -4555,7 +4555,7 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, n[9].data = image; } else if (image) { - _mesa_free(image); + free(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexSubImage2DARB(ctx->Exec, @@ -4578,7 +4578,7 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ - image = _mesa_malloc(imageSize); + image = malloc(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB"); return; @@ -4599,7 +4599,7 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, n[11].data = image; } else if (image) { - _mesa_free(image); + free(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexSubImage3DARB(ctx->Exec, @@ -4788,7 +4788,7 @@ save_LoadProgramNV(GLenum target, GLuint id, GLsizei len, n = alloc_instruction(ctx, OPCODE_LOAD_PROGRAM_NV, 4); if (n) { - GLubyte *programCopy = (GLubyte *) _mesa_malloc(len); + GLubyte *programCopy = (GLubyte *) malloc(len); if (!programCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); return; @@ -4815,7 +4815,7 @@ save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids) n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 2); if (n) { - GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint)); + GLuint *idCopy = (GLuint *) malloc(num * sizeof(GLuint)); if (!idCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV"); return; @@ -4986,7 +4986,7 @@ save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name, n = alloc_instruction(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6); if (n) { - GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len); + GLubyte *nameCopy = (GLubyte *) malloc(len); if (!nameCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV"); return; @@ -5085,7 +5085,7 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len, n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 4); if (n) { - GLubyte *programCopy = (GLubyte *) _mesa_malloc(len); + GLubyte *programCopy = (GLubyte *) malloc(len); if (!programCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); return; @@ -6199,7 +6199,7 @@ save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) static void * memdup(const void *src, GLsizei bytes) { - void *b = bytes >= 0 ? _mesa_malloc(bytes) : NULL; + void *b = bytes >= 0 ? malloc(bytes) : NULL; if (b) memcpy(b, src, bytes); return b; diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c index 4c6139985fe..07a7f9fed80 100644 --- a/src/mesa/main/execmem.c +++ b/src/mesa/main/execmem.c @@ -140,14 +140,14 @@ _mesa_exec_free(void *addr) void * _mesa_exec_malloc(GLuint size) { - return _mesa_malloc( size ); + return malloc( size ); } void _mesa_exec_free(void *addr) { - _mesa_free(addr); + free(addr); } diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index f24baf5acdc..2c1120e19f8 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -576,7 +576,7 @@ append(const char *a, const char *b) { const GLuint aLen = a ? strlen(a) : 0; const GLuint bLen = b ? strlen(b) : 0; - char *s = _mesa_calloc(aLen + bLen + 1); + char *s = calloc(1, aLen + bLen + 1); if (s) { if (a) memcpy(s, a, aLen); @@ -585,7 +585,7 @@ append(const char *a, const char *b) s[aLen + bLen] = '\0'; } if (a) - _mesa_free((void *) a); + free((void *) a); return s; } @@ -685,7 +685,7 @@ _mesa_make_extension_string( GLcontext *ctx ) extStrLen += strlen(extraExt) + 1; /* +1 for space */ /* allocate the extension string */ - s = (char *) _mesa_malloc(extStrLen); + s = (char *) malloc(extStrLen); if (!s) return NULL; diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 41b54209432..065e25fd332 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -192,7 +192,7 @@ _mesa_destroy_framebuffer(struct gl_framebuffer *fb) { if (fb) { _mesa_free_framebuffer_data(fb); - _mesa_free(fb); + free(fb); } } diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index fdfbe6b4f43..975775469d9 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -108,13 +108,13 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table) _mesa_problem(NULL, "In _mesa_DeleteHashTable, found non-freed data"); } - _mesa_free(entry); + free(entry); entry = next; } } _glthread_DESTROY_MUTEX(table->Mutex); _glthread_DESTROY_MUTEX(table->WalkMutex); - _mesa_free(table); + free(table); } @@ -245,7 +245,7 @@ _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key) else { table->Table[pos] = entry->Next; } - _mesa_free(entry); + free(entry); _glthread_UNLOCK_MUTEX(table->Mutex); return; } @@ -282,7 +282,7 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table, for (entry = table->Table[pos]; entry; entry = next) { callback(entry->Key, entry->Data, userData); next = entry->Next; - _mesa_free(entry); + free(entry); } table->Table[pos] = NULL; } diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index bd03217e2a8..dc8d97728bf 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1038,7 +1038,7 @@ _mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32], | (p[3] ); p += 4; } - _mesa_free(ptrn); + free(ptrn); } } @@ -1083,7 +1083,7 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, /* Alloc dest storage */ bytes = ((width + 7) / 8 * height); - buffer = (GLubyte *) _mesa_malloc( bytes ); + buffer = (GLubyte *) malloc( bytes ); if (!buffer) return NULL; @@ -1094,7 +1094,7 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, _mesa_image_address2d(packing, pixels, width, height, GL_COLOR_INDEX, GL_BITMAP, row, 0); if (!src) { - _mesa_free(buffer); + free(buffer); return NULL; } @@ -5232,7 +5232,7 @@ _mesa_unpack_image( GLuint dimensions, { GLubyte *destBuffer - = (GLubyte *) _mesa_malloc(bytesPerRow * height * depth); + = (GLubyte *) malloc(bytesPerRow * height * depth); GLubyte *dst; GLint img, row; if (!destBuffer) diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 5c2c863f976..10224f78882 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -71,27 +71,6 @@ extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg); /** \name Memory */ /*@{*/ -/** Wrapper around malloc() */ -void * -_mesa_malloc(size_t bytes) -{ - return malloc(bytes); -} - -/** Wrapper around calloc() */ -void * -_mesa_calloc(size_t bytes) -{ - return calloc(1, bytes); -} - -/** Wrapper around free() */ -void -_mesa_free(void *ptr) -{ - free(ptr); -} - /** * Allocate aligned memory. * @@ -118,7 +97,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) ASSERT( alignment > 0 ); - ptr = (uintptr_t) _mesa_malloc(bytes + alignment + sizeof(void *)); + ptr = (uintptr_t) malloc(bytes + alignment + sizeof(void *)); if (!ptr) return NULL; @@ -138,8 +117,8 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) } /** - * Same as _mesa_align_malloc(), but using _mesa_calloc() instead of - * _mesa_malloc() + * Same as _mesa_align_malloc(), but using calloc(1, ) instead of + * malloc() */ void * _mesa_align_calloc(size_t bytes, unsigned long alignment) @@ -167,7 +146,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment) ASSERT( alignment > 0 ); - ptr = (uintptr_t) _mesa_calloc(bytes + alignment + sizeof(void *)); + ptr = (uintptr_t) calloc(1, bytes + alignment + sizeof(void *)); if (!ptr) return NULL; @@ -203,7 +182,7 @@ _mesa_align_free(void *ptr) #else void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); void *realAddr = *cubbyHole; - _mesa_free(realAddr); + free(realAddr); #endif /* defined(HAVE_POSIX_MEMALIGN) */ } @@ -236,11 +215,11 @@ void * _mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize) { const size_t copySize = (oldSize < newSize) ? oldSize : newSize; - void *newBuffer = _mesa_malloc(newSize); + void *newBuffer = malloc(newSize); if (newBuffer && oldBuffer && copySize > 0) memcpy(newBuffer, oldBuffer, copySize); if (oldBuffer) - _mesa_free(oldBuffer); + free(oldBuffer); return newBuffer; } @@ -798,7 +777,7 @@ _mesa_getenv( const char *var ) /*@{*/ /** - * Implemented using _mesa_malloc() and strcpy. + * Implemented using malloc() and strcpy. * Note that NULL is handled accordingly. */ char * @@ -806,7 +785,7 @@ _mesa_strdup( const char *s ) { if (s) { size_t l = strlen(s); - char *s2 = (char *) _mesa_malloc(l + 1); + char *s2 = (char *) malloc(l + 1); if (s2) strcpy(s2, s); return s2; diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 106dd021a14..4eabdfdb0d2 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -50,15 +50,15 @@ extern "C" { /*@{*/ /** Allocate \p BYTES bytes */ -#define MALLOC(BYTES) _mesa_malloc(BYTES) +#define MALLOC(BYTES) malloc(BYTES) /** Allocate and zero \p BYTES bytes */ -#define CALLOC(BYTES) _mesa_calloc(BYTES) +#define CALLOC(BYTES) calloc(1, BYTES) /** Allocate a structure of type \p T */ -#define MALLOC_STRUCT(T) (struct T *) _mesa_malloc(sizeof(struct T)) +#define MALLOC_STRUCT(T) (struct T *) malloc(sizeof(struct T)) /** Allocate and zero a structure of type \p T */ -#define CALLOC_STRUCT(T) (struct T *) _mesa_calloc(sizeof(struct T)) +#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T)) /** Free memory */ -#define FREE(PTR) _mesa_free(PTR) +#define FREE(PTR) free(PTR) /** Allocate \p BYTES aligned at \p N bytes */ #define ALIGN_MALLOC(BYTES, N) _mesa_align_malloc(BYTES, N) @@ -508,15 +508,6 @@ _mesa_little_endian(void) */ extern void * -_mesa_malloc( size_t bytes ); - -extern void * -_mesa_calloc( size_t bytes ); - -extern void -_mesa_free( void *ptr ); - -extern void * _mesa_align_malloc( size_t bytes, unsigned long alignment ); extern void * diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 654faa5c770..6899ed0ddf3 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1433,7 +1433,7 @@ _mesa_free_lighting_data( GLcontext *ctx ) /* Free lighting shininess exponentiation table */ foreach_s( s, tmps, ctx->_ShineTabList ) { - _mesa_free( s ); + free( s ); } - _mesa_free( ctx->_ShineTabList ); + free( ctx->_ShineTabList ); } diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 1da576337f9..415abcdfa1e 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1537,15 +1537,15 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, size = _mesa_bytes_per_pixel(srcImage->_BaseFormat, CHAN_TYPE) * srcImage->Width * srcImage->Height * srcImage->Depth + 20; /* 20 extra bytes, just be safe when calling last FetchTexel */ - srcData = (GLubyte *) _mesa_malloc(size); + srcData = (GLubyte *) malloc(size); if (!srcData) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); return; } - dstData = (GLubyte *) _mesa_malloc(size / 2); /* 1/4 would probably be OK */ + dstData = (GLubyte *) malloc(size / 2); /* 1/4 would probably be OK */ if (!dstData) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); - _mesa_free((void *) srcData); + free((void *) srcData); return; } @@ -1590,8 +1590,8 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, if (!nextLevel) { /* all done */ if (_mesa_is_format_compressed(srcImage->TexFormat)) { - _mesa_free((void *) srcData); - _mesa_free(dstData); + free((void *) srcData); + free(dstData); } return; } diff --git a/src/mesa/main/mm.c b/src/mesa/main/mm.c index d430bcdb840..3ef38e94be9 100644 --- a/src/mesa/main/mm.c +++ b/src/mesa/main/mm.c @@ -60,13 +60,13 @@ mmInit(unsigned ofs, unsigned size) if (!size) return NULL; - heap = (struct mem_block *) _mesa_calloc(sizeof(struct mem_block)); + heap = (struct mem_block *) calloc(1, sizeof(struct mem_block)); if (!heap) return NULL; - block = (struct mem_block *) _mesa_calloc(sizeof(struct mem_block)); + block = (struct mem_block *) calloc(1, sizeof(struct mem_block)); if (!block) { - _mesa_free(heap); + free(heap); return NULL; } @@ -98,7 +98,7 @@ SliceBlock(struct mem_block *p, /* break left [p, newblock, p->next], then p = newblock */ if (startofs > p->ofs) { - newblock = (struct mem_block*) _mesa_calloc(sizeof(struct mem_block)); + newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block)); if (!newblock) return NULL; newblock->ofs = startofs; @@ -122,7 +122,7 @@ SliceBlock(struct mem_block *p, /* break right, also [p, newblock, p->next] */ if (size < p->size) { - newblock = (struct mem_block*) _mesa_calloc(sizeof(struct mem_block)); + newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block)); if (!newblock) return NULL; newblock->ofs = startofs + size; @@ -225,7 +225,7 @@ Join2Blocks(struct mem_block *p) q->next_free->prev_free = q->prev_free; q->prev_free->next_free = q->next_free; - _mesa_free(q); + free(q); return 1; } return 0; @@ -270,9 +270,9 @@ mmDestroy(struct mem_block *heap) for (p = heap->next; p != heap; ) { struct mem_block *next = p->next; - _mesa_free(p); + free(p); p = next; } - _mesa_free(heap); + free(heap); } diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index 387a82fc9df..471352f472f 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -114,7 +114,7 @@ _mesa_check_query(GLcontext *ctx, struct gl_query_object *q) static void _mesa_delete_query(GLcontext *ctx, struct gl_query_object *q) { - _mesa_free(q); + free(q); } diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index aec22d9d148..c44db255d62 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -1122,7 +1122,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, /* free old buffer storage */ if (rb->Data) { - _mesa_free(rb->Data); + free(rb->Data); rb->Data = NULL; } @@ -1179,10 +1179,10 @@ alloc_storage_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, /* next, resize my alpha buffer */ if (arb->Data) { - _mesa_free(arb->Data); + free(arb->Data); } - arb->Data = _mesa_malloc(width * height * sizeof(GLubyte)); + arb->Data = malloc(width * height * sizeof(GLubyte)); if (arb->Data == NULL) { arb->Width = 0; arb->Height = 0; @@ -1204,13 +1204,13 @@ static void delete_renderbuffer_alpha8(struct gl_renderbuffer *arb) { if (arb->Data) { - _mesa_free(arb->Data); + free(arb->Data); } ASSERT(arb->Wrapped); ASSERT(arb != arb->Wrapped); arb->Wrapped->Delete(arb->Wrapped); arb->Wrapped = NULL; - _mesa_free(arb); + free(arb); } @@ -1460,9 +1460,9 @@ void _mesa_delete_renderbuffer(struct gl_renderbuffer *rb) { if (rb->Data) { - _mesa_free(rb->Data); + free(rb->Data); } - _mesa_free(rb); + free(rb); } diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c index 91f2a7a7bf4..e6f6add7688 100644 --- a/src/mesa/main/shaders.c +++ b/src/mesa/main/shaders.c @@ -434,7 +434,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, * This array holds offsets of where the appropriate string ends, thus the * last element will be set to the total length of the source code. */ - offsets = (GLint *) _mesa_malloc(count * sizeof(GLint)); + offsets = (GLint *) malloc(count * sizeof(GLint)); if (offsets == NULL) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB"); return; @@ -442,7 +442,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, for (i = 0; i < count; i++) { if (string[i] == NULL) { - _mesa_free((GLvoid *) offsets); + free((GLvoid *) offsets); _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderSourceARB(null string)"); return; } @@ -460,9 +460,9 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, * valgrind warnings in the parser/grammer code. */ totalLength = offsets[count - 1] + 2; - source = (GLcharARB *) _mesa_malloc(totalLength * sizeof(GLcharARB)); + source = (GLcharARB *) malloc(totalLength * sizeof(GLcharARB)); if (source == NULL) { - _mesa_free((GLvoid *) offsets); + free((GLvoid *) offsets); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB"); return; } @@ -491,7 +491,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, if (newSource) { _mesa_fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n", shaderObj, checksum, filename); - _mesa_free(source); + free(source); source = newSource; } } @@ -504,7 +504,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, sh->SourceChecksum = checksum; /* save original checksum */ } - _mesa_free(offsets); + free(offsets); } diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index b889364f0dc..e364e24048f 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -362,7 +362,7 @@ free_shared_state(GLcontext *ctx, struct gl_shared_state *shared) _glthread_DESTROY_MUTEX(shared->Mutex); _glthread_DESTROY_MUTEX(shared->TexMutex); - _mesa_free(shared); + free(shared); } diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c index 36b48fd9f26..1bff308177d 100644 --- a/src/mesa/main/syncobj.c +++ b/src/mesa/main/syncobj.c @@ -78,7 +78,7 @@ static void _mesa_delete_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj) { (void) ctx; - _mesa_free(syncObj); + free(syncObj); } diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 73a31a17ec3..71e40dd3e93 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -105,7 +105,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) dst, dstRowStride); if (tempImage) - _mesa_free((void*) tempImage); + free((void*) tempImage); return GL_TRUE; } @@ -162,7 +162,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) dst, dstRowStride); if (tempImage) - _mesa_free((void*) tempImage); + free((void*) tempImage); return GL_TRUE; } @@ -1305,7 +1305,7 @@ fxt1_encode (GLuint width, GLuint height, GLint comps, if ((width & 7) | (height & 3)) { GLint newWidth = (width + 7) & ~7; GLint newHeight = (height + 3) & ~3; - newSource = _mesa_malloc(comps * newWidth * newHeight * sizeof(GLchan)); + newSource = malloc(comps * newWidth * newHeight * sizeof(GLchan)); if (!newSource) { GET_CURRENT_CONTEXT(ctx); _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture compression"); @@ -1324,7 +1324,7 @@ fxt1_encode (GLuint width, GLuint height, GLint comps, if (CHAN_TYPE != GL_UNSIGNED_BYTE) { const GLuint n = width * height * comps; const GLchan *src = (const GLchan *) source; - GLubyte *dest = (GLubyte *) _mesa_malloc(n * sizeof(GLubyte)); + GLubyte *dest = (GLubyte *) malloc(n * sizeof(GLubyte)); GLuint i; if (!dest) { GET_CURRENT_CONTEXT(ctx); @@ -1335,7 +1335,7 @@ fxt1_encode (GLuint width, GLuint height, GLint comps, dest[i] = CHAN_TO_UBYTE(src[i]); } if (newSource != NULL) { - _mesa_free(newSource); + free(newSource); } newSource = dest; /* we'll free this buffer before returning */ source = dest; /* the new, GLubyte incoming image */ @@ -1361,7 +1361,7 @@ fxt1_encode (GLuint width, GLuint height, GLint comps, cleanUp: if (newSource != NULL) { - _mesa_free(newSource); + free(newSource); } } diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index b271a539a72..fcd28a4b4e5 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -213,7 +213,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) } if (tempImage) - _mesa_free((void *) tempImage); + free((void *) tempImage); return GL_TRUE; } @@ -275,7 +275,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) } if (tempImage) - _mesa_free((void*) tempImage); + free((void*) tempImage); return GL_TRUE; } @@ -336,7 +336,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) } if (tempImage) - _mesa_free((void *) tempImage); + free((void *) tempImage); return GL_TRUE; } @@ -397,7 +397,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) } if (tempImage) - _mesa_free((void *) tempImage); + free((void *) tempImage); return GL_TRUE; } diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index da3c6f9841f..11e37dc34e5 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -488,8 +488,8 @@ _mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *texImage ) ASSERT(texImage->Data == NULL); if (texImage->ImageOffsets) - _mesa_free(texImage->ImageOffsets); - _mesa_free(texImage); + free(texImage->ImageOffsets); + free(texImage); } @@ -843,7 +843,7 @@ clear_teximage_fields(struct gl_texture_image *img) img->Depth = 0; img->RowStride = 0; if (img->ImageOffsets) { - _mesa_free(img->ImageOffsets); + free(img->ImageOffsets); img->ImageOffsets = NULL; } img->Width2 = 0; @@ -932,8 +932,8 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, * case code in the texstore routines. */ if (img->ImageOffsets) - _mesa_free(img->ImageOffsets); - img->ImageOffsets = (GLuint *) _mesa_malloc(depth * sizeof(GLuint)); + free(img->ImageOffsets); + img->ImageOffsets = (GLuint *) malloc(depth * sizeof(GLuint)); for (i = 0; i < depth; i++) { img->ImageOffsets[i] = i * width * height; } diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 649f3587cb6..feba6e95b6b 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -207,7 +207,7 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) _glthread_DESTROY_MUTEX(texObj->Mutex); /* free this object */ - _mesa_free(texObj); + free(texObj); } diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index cf603d46d86..dbed51a77f7 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -414,7 +414,7 @@ static void delete_texture_wrapper(struct gl_renderbuffer *rb) { ASSERT(rb->RefCount == 0); - _mesa_free(rb); + free(rb); } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index ab572a13edf..bd63c77a392 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -347,16 +347,16 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, GLfloat *convImage; /* pre-convolution image buffer (3D) */ - tempImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth + tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth * 4 * sizeof(GLfloat)); if (!tempImage) return NULL; /* post-convolution image buffer (2D) */ - convImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight + convImage = (GLfloat *) malloc(srcWidth * srcHeight * 4 * sizeof(GLfloat)); if (!convImage) { - _mesa_free(tempImage); + free(tempImage); return NULL; } @@ -419,7 +419,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, } } /* loop over 3D image slices */ - _mesa_free(convImage); + free(convImage); /* might need these below */ srcWidth = convWidth; @@ -433,7 +433,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, GLfloat *dst; GLint img, row; - tempImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth + tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth * components * sizeof(GLfloat)); if (!tempImage) return NULL; @@ -472,10 +472,10 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, */ ASSERT(texComponents >= logComponents); - newImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth + newImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth * texComponents * sizeof(GLfloat)); if (!newImage) { - _mesa_free(tempImage); + free(tempImage); return NULL; } @@ -495,7 +495,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, } } - _mesa_free(tempImage); + free(tempImage); tempImage = newImage; } @@ -582,11 +582,11 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, #endif /* unpack and transfer the source image */ - tempImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth + tempImage = (GLchan *) malloc(srcWidth * srcHeight * srcDepth * components * sizeof(GLchan)); if (!tempImage) { if (freeSrcImage) { - _mesa_free((void *) srcAddr); + free((void *) srcAddr); } return NULL; } @@ -611,7 +611,7 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, /* If we made a temporary image for convolution, free it here */ if (freeSrcImage) { - _mesa_free((void *) srcAddr); + free((void *) srcAddr); } if (logicalBaseFormat != textureBaseFormat) { @@ -631,10 +631,10 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, */ ASSERT(texComponents >= logComponents); - newImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth + newImage = (GLchan *) malloc(srcWidth * srcHeight * srcDepth * texComponents * sizeof(GLchan)); if (!newImage) { - _mesa_free(tempImage); + free(tempImage); return NULL; } @@ -654,7 +654,7 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, } } - _mesa_free(tempImage); + free(tempImage); tempImage = newImage; } @@ -1267,7 +1267,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) dstRow += dstRowStride; } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -1395,7 +1395,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) dstRow += dstRowStride; } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -1606,7 +1606,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) dstRow += dstRowStride; } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -1733,7 +1733,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) dstRow += dstRowStride; } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -1841,7 +1841,7 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) dstRow += dstRowStride; } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -1912,7 +1912,7 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) dstRow += dstRowStride; } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -1970,7 +1970,7 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) dstRow += dstRowStride; } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -2040,7 +2040,7 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) dstRow += dstRowStride; } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -2143,7 +2143,7 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) dstRow += dstRowStride; } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -2218,7 +2218,7 @@ _mesa_texstore_al1616(TEXSTORE_PARAMS) dstRow += dstRowStride; } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -2273,7 +2273,7 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) dstRow += dstRowStride; } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -2360,7 +2360,7 @@ _mesa_texstore_a8(TEXSTORE_PARAMS) src += srcWidth; } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -2518,7 +2518,7 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) GLbyte *tempImage, *dst, *src; GLint row; - tempImage = (GLbyte *) _mesa_malloc(srcWidth * srcHeight * srcDepth + tempImage = (GLbyte *) malloc(srcWidth * srcHeight * srcDepth * components * sizeof(GLbyte)); if (!tempImage) return GL_FALSE; @@ -2546,7 +2546,7 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) dst += dstRowStride; src += srcWidth * texelBytes; } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -2667,7 +2667,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) dstRow += dstRowStride; } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -2925,7 +2925,7 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } @@ -2996,7 +2996,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) } } - _mesa_free((void *) tempImage); + free((void *) tempImage); } return GL_TRUE; } diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 9d23c577bd1..e474fe7fa51 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -122,7 +122,7 @@ _mesa_compute_version(GLcontext *ctx) compute_version(ctx, &ctx->VersionMajor, &ctx->VersionMinor); - ctx->VersionString = (char *) _mesa_malloc(max); + ctx->VersionString = (char *) malloc(max); if (ctx->VersionString) { _mesa_snprintf(ctx->VersionString, max, "%u.%u Mesa " MESA_VERSION_STRING, ctx->VersionMajor, ctx->VersionMinor); |