diff options
author | Matt Turner <mattst88@gmail.com> | 2012-09-03 20:24:35 -0700 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2012-09-05 22:28:50 -0700 |
commit | 5067506ea6ada5eeae33b1acf1c916e00121c12a (patch) | |
tree | a6b4ff2e3cf5fb6058101aee3b6f1dcd3f382c15 /src/mesa/program/arbprogparse.c | |
parent | a9e8054fffc6e3e6a5f108a96c331858c28a5862 (diff) | |
download | external_mesa3d-5067506ea6ada5eeae33b1acf1c916e00121c12a.zip external_mesa3d-5067506ea6ada5eeae33b1acf1c916e00121c12a.tar.gz external_mesa3d-5067506ea6ada5eeae33b1acf1c916e00121c12a.tar.bz2 |
Remove useless checks for NULL before freeing
This patch has been generated by the following Coccinelle semantic
patch:
// Remove useless checks for NULL before freeing
//
// free (NULL) is a no-op, so there is no need to avoid it
@@
expression E;
@@
+ free (E);
+ E = NULL;
- if (unlikely (E != NULL)) {
- free(E);
(
- E = NULL;
|
- E = 0;
)
...
- }
@@
expression E;
type T;
@@
+ free ((T) E);
+ E = NULL;
- if (unlikely (E != NULL)) {
- free((T) E);
(
- E = NULL;
|
- E = 0;
)
...
- }
@@
expression E;
@@
+ free (E);
- if (unlikely (E != NULL)) {
- free (E);
- }
@@
expression E;
type T;
@@
+ free ((T) E);
- if (unlikely (E != NULL)) {
- free ((T) E);
- }
Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/program/arbprogparse.c')
-rw-r--r-- | src/mesa/program/arbprogparse.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c index 72e51dd..527bb93 100644 --- a/src/mesa/program/arbprogparse.c +++ b/src/mesa/program/arbprogparse.c @@ -84,8 +84,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target, return; } - if (program->Base.String != NULL) - free(program->Base.String); + free(program->Base.String); /* Copy the relevant contents of the arb_program struct into the * fragment_program struct. @@ -122,8 +121,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target, program->UsesKill = state.fragment.UsesKill; program->UsesDFdy = state.fragment.UsesDFdy; - if (program->Base.Instructions) - free(program->Base.Instructions); + free(program->Base.Instructions); program->Base.Instructions = prog.Instructions; if (program->Base.Parameters) @@ -179,8 +177,7 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target, return; } - if (program->Base.String != NULL) - free(program->Base.String); + free(program->Base.String); /* Copy the relevant contents of the arb_program struct into the * vertex_program struct. @@ -202,8 +199,7 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target, program->IsPositionInvariant = (state.option.PositionInvariant) ? GL_TRUE : GL_FALSE; - if (program->Base.Instructions) - free(program->Base.Instructions); + free(program->Base.Instructions); program->Base.Instructions = prog.Instructions; if (program->Base.Parameters) |