From e095d5812a0237d08eabae1977730e38ac5751c9 Mon Sep 17 00:00:00 2001 From: Shunichi Fuji Date: Fri, 26 Sep 2008 18:55:13 +0900 Subject: [PATCH] mesa: drop calloc from _mesa_get_fixed_func_vertex_program Signed-off-by: Shunichi Fuji --- src/mesa/main/ffvertex_prog.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 787672be9f1..308b4ef7115 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -178,12 +178,12 @@ static GLboolean check_active_shininess( GLcontext *ctx, -static struct state_key *make_state_key( GLcontext *ctx ) +static void make_state_key( GLcontext *ctx, struct state_key *key ) { const struct gl_fragment_program *fp; - struct state_key *key = CALLOC_STRUCT(state_key); GLuint i; + memset(key, 0, sizeof(struct state_key)); fp = ctx->FragmentProgram._Current; /* This now relies on texenvprogram.c being active: @@ -301,8 +301,6 @@ static struct state_key *make_state_key( GLcontext *ctx ) texUnit->GenModeQ ); } } - - return key; } @@ -1714,16 +1712,16 @@ struct gl_vertex_program * _mesa_get_fixed_func_vertex_program(GLcontext *ctx) { struct gl_vertex_program *prog; - struct state_key *key; + struct state_key key; /* Grab all the relevent state and put it in a single structure: */ - key = make_state_key(ctx); + make_state_key(ctx, &key); /* Look for an already-prepared program for this state: */ prog = (struct gl_vertex_program *) - _mesa_search_program_cache(ctx->VertexProgram.Cache, key, sizeof(*key)); + _mesa_search_program_cache(ctx->VertexProgram.Cache, &key, sizeof(key)); if (!prog) { /* OK, we'll have to build a new one */ @@ -1735,7 +1733,7 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx) if (!prog) return NULL; - create_new_program( key, prog, + create_new_program( &key, prog, ctx->Const.VertexProgram.MaxTemps ); #if 0 @@ -1744,10 +1742,8 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx) &prog->Base ); #endif _mesa_program_cache_insert(ctx, ctx->VertexProgram.Cache, - key, sizeof(*key), &prog->Base); + &key, sizeof(key), &prog->Base); } - _mesa_free(key); - return prog; } -- 2.30.2