diff options
author | Matt Turner <mattst88@gmail.com> | 2012-09-04 23:33:28 -0700 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2012-09-05 22:28:50 -0700 |
commit | b6109de34f04747ed2937a2e63c1f53740202d3e (patch) | |
tree | 6578024b65adc9dc2bc3bd4a23cf44f29808b3b2 /src/gallium/drivers/i915 | |
parent | da3282b6e2f374b88daf09f7f3ba5b05af45f51a (diff) |
Remove useless checks for NULL before freeing
Same as earlier commit, except for "FREE"
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/gallium/drivers/i915')
-rw-r--r-- | src/gallium/drivers/i915/i915_resource_texture.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_state.c | 7 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c index e60b5b435cc..603a379d0c8 100644 --- a/src/gallium/drivers/i915/i915_resource_texture.c +++ b/src/gallium/drivers/i915/i915_resource_texture.c @@ -705,8 +705,7 @@ i915_texture_destroy(struct pipe_screen *screen, iws->buffer_destroy(iws, tex->buffer); for (i = 0; i < Elements(tex->image_offset); i++) - if (tex->image_offset[i]) - FREE(tex->image_offset[i]); + FREE(tex->image_offset[i]); FREE(tex); } diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index fdbff8b4a4e..410615f212a 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -614,10 +614,8 @@ void i915_delete_fs_state(struct pipe_context *pipe, void *shader) { struct i915_fragment_shader *ifs = (struct i915_fragment_shader *) shader; - if (ifs->decl) { - FREE(ifs->decl); - ifs->decl = NULL; - } + FREE(ifs->decl); + ifs->decl = NULL; if (ifs->program) { FREE(ifs->program); @@ -625,6 +623,7 @@ void i915_delete_fs_state(struct pipe_context *pipe, void *shader) FREE((struct tgsi_token *)ifs->state.tokens); ifs->state.tokens = NULL; } + ifs->program_len = 0; ifs->decl_len = 0; |