From 1a2f4dd8768703fbc1b2a0d5be342345644805b4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 12 Feb 2009 10:08:25 -0700 Subject: mesa: consistantly use mesa memory-functions in gallium state tracker Use _mesa_malloc(), _mesa_free(), etc everywhere, not malloc(), free(), etc. Still using CALLOC_STRUCT() at this point. --- src/mesa/state_tracker/st_cb_bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/state_tracker/st_cb_bitmap.c') diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index f14e562400b..fff348de59e 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -827,7 +827,7 @@ st_destroy_bitmap(struct st_context *st) if (st->bitmap.cache) { pipe_texture_release(&st->bitmap.cache->texture); - FREE(st->bitmap.cache); + _mesa_free(st->bitmap.cache); st->bitmap.cache = NULL; } } -- cgit v1.2.3 From f1a59a6dd7b7b0523db191d82b3af1a841c6475d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 12 Feb 2009 10:14:36 -0700 Subject: mesa: use new ST_CALLOC_STRUCT() macro in gallium state tracker --- src/mesa/state_tracker/st_atom_shader.c | 2 +- src/mesa/state_tracker/st_cb_bitmap.c | 2 +- src/mesa/state_tracker/st_cb_bufferobjects.c | 2 +- src/mesa/state_tracker/st_cb_fbo.c | 4 ++-- src/mesa/state_tracker/st_cb_feedback.c | 4 ++-- src/mesa/state_tracker/st_cb_program.c | 4 ++-- src/mesa/state_tracker/st_cb_queryobj.c | 2 +- src/mesa/state_tracker/st_cb_rasterpos.c | 2 +- src/mesa/state_tracker/st_cb_texture.c | 4 ++-- src/mesa/state_tracker/st_context.c | 2 +- src/mesa/state_tracker/st_context.h | 4 ++++ src/mesa/state_tracker/st_framebuffer.c | 2 +- 12 files changed, 19 insertions(+), 15 deletions(-) (limited to 'src/mesa/state_tracker/st_cb_bitmap.c') diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index 5653933e123..bed3ff4ae5b 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -165,7 +165,7 @@ find_translated_vp(struct st_context *st, /* No? Allocate translated vp object now */ if (!xvp) { - xvp = CALLOC_STRUCT(translated_vertex_program); + xvp = ST_CALLOC_STRUCT(translated_vertex_program); xvp->frag_inputs = fragInputsRead; xvp->master = stvp; diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index fff348de59e..da0ea645580 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -798,7 +798,7 @@ st_init_bitmap(struct st_context *st) } /* alloc bitmap cache object */ - st->bitmap.cache = CALLOC_STRUCT(bitmap_cache); + st->bitmap.cache = ST_CALLOC_STRUCT(bitmap_cache); reset_cache(st); } diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index e601ec46f8f..aba1cda9323 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -55,7 +55,7 @@ static struct gl_buffer_object * st_bufferobj_alloc(GLcontext *ctx, GLuint name, GLenum target) { - struct st_buffer_object *st_obj = CALLOC_STRUCT(st_buffer_object); + struct st_buffer_object *st_obj = ST_CALLOC_STRUCT(st_buffer_object); if (!st_obj) return NULL; diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index fd85a7a3050..611d78df0c4 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -232,7 +232,7 @@ st_new_framebuffer(GLcontext *ctx, GLuint name) static struct gl_renderbuffer * st_new_renderbuffer(GLcontext *ctx, GLuint name) { - struct st_renderbuffer *strb = CALLOC_STRUCT(st_renderbuffer); + struct st_renderbuffer *strb = ST_CALLOC_STRUCT(st_renderbuffer); if (strb) { _mesa_init_renderbuffer(&strb->Base, name); strb->Base.Delete = st_renderbuffer_delete; @@ -254,7 +254,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples) { struct st_renderbuffer *strb; - strb = CALLOC_STRUCT(st_renderbuffer); + strb = ST_CALLOC_STRUCT(st_renderbuffer); if (!strb) { _mesa_error(NULL, GL_OUT_OF_MEMORY, "creating renderbuffer"); return NULL; diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c index c7e8aa7cc56..86d35422622 100644 --- a/src/mesa/state_tracker/st_cb_feedback.c +++ b/src/mesa/state_tracker/st_cb_feedback.c @@ -184,7 +184,7 @@ feedback_destroy( struct draw_stage *stage ) static struct draw_stage * draw_glfeedback_stage(GLcontext *ctx, struct draw_context *draw) { - struct feedback_stage *fs = CALLOC_STRUCT(feedback_stage); + struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); fs->stage.draw = draw; fs->stage.next = NULL; @@ -257,7 +257,7 @@ select_destroy( struct draw_stage *stage ) static struct draw_stage * draw_glselect_stage(GLcontext *ctx, struct draw_context *draw) { - struct feedback_stage *fs = CALLOC_STRUCT(feedback_stage); + struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); fs->stage.draw = draw; fs->stage.next = NULL; diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index 44f47865f80..4398ab28392 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -99,7 +99,7 @@ static struct gl_program *st_new_program( GLcontext *ctx, { switch (target) { case GL_VERTEX_PROGRAM_ARB: { - struct st_vertex_program *prog = CALLOC_STRUCT(st_vertex_program); + struct st_vertex_program *prog = ST_CALLOC_STRUCT(st_vertex_program); prog->serialNo = SerialNo++; @@ -111,7 +111,7 @@ static struct gl_program *st_new_program( GLcontext *ctx, case GL_FRAGMENT_PROGRAM_ARB: case GL_FRAGMENT_PROGRAM_NV: { - struct st_fragment_program *prog = CALLOC_STRUCT(st_fragment_program); + struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program); prog->serialNo = SerialNo++; diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c index bd2716a45f5..dcf4c38eb61 100644 --- a/src/mesa/state_tracker/st_cb_queryobj.c +++ b/src/mesa/state_tracker/st_cb_queryobj.c @@ -64,7 +64,7 @@ st_query_object(struct gl_query_object *q) static struct gl_query_object * st_NewQueryObject(GLcontext *ctx, GLuint id) { - struct st_query_object *stq = CALLOC_STRUCT(st_query_object); + struct st_query_object *stq = ST_CALLOC_STRUCT(st_query_object); if (stq) { stq->base.Id = id; stq->base.Ready = GL_TRUE; diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index f4057778bda..7dd23527399 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -180,7 +180,7 @@ rastpos_point(struct draw_stage *stage, struct prim_header *prim) static struct rastpos_stage * new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw) { - struct rastpos_stage *rs = CALLOC_STRUCT(rastpos_stage); + struct rastpos_stage *rs = ST_CALLOC_STRUCT(rastpos_stage); GLuint i; rs->stage.draw = draw; diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 9279a768c82..3dd1f1d737d 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -114,7 +114,7 @@ st_NewTextureImage(GLcontext * ctx) { DBG("%s\n", __FUNCTION__); (void) ctx; - return (struct gl_texture_image *) CALLOC_STRUCT(st_texture_image); + return (struct gl_texture_image *) ST_CALLOC_STRUCT(st_texture_image); } @@ -122,7 +122,7 @@ st_NewTextureImage(GLcontext * ctx) static struct gl_texture_object * st_NewTextureObject(GLcontext * ctx, GLuint name, GLenum target) { - struct st_texture_object *obj = CALLOC_STRUCT(st_texture_object); + struct st_texture_object *obj = ST_CALLOC_STRUCT(st_texture_object); DBG("%s\n", __FUNCTION__); _mesa_initialize_texture_object(&obj->base, name, target); diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 34f76d44625..6d6c9f43329 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -105,7 +105,7 @@ static struct st_context * st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe ) { uint i; - struct st_context *st = CALLOC_STRUCT( st_context ); + struct st_context *st = ST_CALLOC_STRUCT( st_context ); ctx->st = st; diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 695ac4a96f4..3547925ad7f 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -242,6 +242,10 @@ st_fb_orientation(const struct gl_framebuffer *fb) } +/** clear-alloc a struct-sized object, with casting */ +#define ST_CALLOC_STRUCT(T) (struct T *) _mesa_calloc(sizeof(struct T)) + + extern int st_get_msaa(void); diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 0d9c7b97e3d..0d4474a8b3a 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -49,7 +49,7 @@ st_create_framebuffer( const __GLcontextModes *visual, uint width, uint height, void *private) { - struct st_framebuffer *stfb = CALLOC_STRUCT(st_framebuffer); + struct st_framebuffer *stfb = ST_CALLOC_STRUCT(st_framebuffer); if (stfb) { int samples = st_get_msaa(); -- cgit v1.2.3