summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@tungstengraphics.com>2008-04-22 20:29:42 +0100
committerAlan Hourihane <alanh@tungstengraphics.com>2008-04-22 20:29:42 +0100
commit5545b46571c903d293f8a52ec0a36c1b19e6a693 (patch)
tree28db92f50ad65f21496cd0b8ad2cdd5ac0a6e659
parent06b0a7acce6aa4415adaf7456f17e46230bbd7bc (diff)
small cleanups
-rw-r--r--src/mesa/shader/prog_parameter.c3
-rw-r--r--src/mesa/shader/program.c1
-rw-r--r--src/mesa/shader/shader_api.c12
3 files changed, 9 insertions, 7 deletions
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index 46d30872e4..3ad7215755 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -40,8 +40,7 @@
struct gl_program_parameter_list *
_mesa_new_parameter_list(void)
{
- return (struct gl_program_parameter_list *)
- _mesa_calloc(sizeof(struct gl_program_parameter_list));
+ return CALLOC_STRUCT(gl_program_parameter_list);
}
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index 95cabe7323..a8983703fa 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -187,7 +187,6 @@ _mesa_init_program_struct( GLcontext *ctx, struct gl_program *prog,
{
(void) ctx;
if (prog) {
- _mesa_bzero(prog, sizeof(*prog));
prog->Id = id;
prog->Target = target;
prog->Resident = GL_TRUE;
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 5f9e2b84a4..218c7cd309 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -128,10 +128,17 @@ _mesa_free_shader_program_data(GLcontext *ctx,
for (i = 0; i < shProg->NumShaders; i++) {
_mesa_reference_shader(ctx, &shProg->Shaders[i], NULL);
}
+ shProg->NumShaders = 0;
+
if (shProg->Shaders) {
_mesa_free(shProg->Shaders);
shProg->Shaders = NULL;
}
+
+ if (shProg->InfoLog) {
+ _mesa_free(shProg->InfoLog);
+ shProg->InfoLog = NULL;
+ }
}
@@ -142,10 +149,7 @@ void
_mesa_free_shader_program(GLcontext *ctx, struct gl_shader_program *shProg)
{
_mesa_free_shader_program_data(ctx, shProg);
- if (shProg->Shaders) {
- _mesa_free(shProg->Shaders);
- shProg->Shaders = NULL;
- }
+
_mesa_free(shProg);
}