summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShunichi Fuji <[email protected]>2008-09-26 18:55:13 +0900
committerKeith Whitwell <[email protected]>2008-09-29 10:38:45 +0100
commite095d5812a0237d08eabae1977730e38ac5751c9 (patch)
tree23531b70fdaf2b66248a026490b75174d66155f4 /src
parent2b8d8989fb6f9c36baf166fc715182a1407ebadb (diff)
mesa: drop calloc from _mesa_get_fixed_func_vertex_program
Signed-off-by: Shunichi Fuji <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/ffvertex_prog.c18
1 files 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;
}