summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-09-21 21:13:33 -0700
committerMatt Turner <[email protected]>2014-12-08 17:02:19 -0800
commit9019e5e19532fe214fc6e45b9ee1f60bbe332456 (patch)
treec382866b78653aea157f085c9cdb8bd3695798e8 /src/gallium/state_trackers
parentcae7a2a0319e31eef0975edafc730efd3bd2c8d4 (diff)
Remove useless checks for NULL before freeing
See commits 5067506e and b6109de3 for the Coccinelle script. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/hgl/hgl.c6
-rw-r--r--src/gallium/state_trackers/nine/nine_shader.c6
-rw-r--r--src/gallium/state_trackers/nine/pixelshader9.c3
-rw-r--r--src/gallium/state_trackers/nine/stateblock9.c8
-rw-r--r--src/gallium/state_trackers/nine/swapchain9.c2
-rw-r--r--src/gallium/state_trackers/nine/vertexdeclaration9.c9
-rw-r--r--src/gallium/state_trackers/nine/vertexshader9.c3
7 files changed, 14 insertions, 23 deletions
diff --git a/src/gallium/state_trackers/hgl/hgl.c b/src/gallium/state_trackers/hgl/hgl.c
index ce2ffb1d418..4d7c479e616 100644
--- a/src/gallium/state_trackers/hgl/hgl.c
+++ b/src/gallium/state_trackers/hgl/hgl.c
@@ -214,8 +214,7 @@ hgl_destroy_st_manager(struct st_manager *manager)
{
CALLED();
- if (manager)
- FREE(manager);
+ FREE(manager);
}
@@ -313,6 +312,5 @@ hgl_destroy_st_visual(struct st_visual* visual)
{
CALLED();
- if (visual)
- FREE(visual);
+ FREE(visual);
}
diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c
index 3c39b246101..c2a0f4dbd9d 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -2767,10 +2767,8 @@ tx_dtor(struct shader_translator *tx)
{
if (tx->num_inst_labels)
FREE(tx->inst_labels);
- if (tx->lconstf)
- FREE(tx->lconstf);
- if (tx->regs.r)
- FREE(tx->regs.r);
+ FREE(tx->lconstf);
+ FREE(tx->regs.r);
FREE(tx);
}
diff --git a/src/gallium/state_trackers/nine/pixelshader9.c b/src/gallium/state_trackers/nine/pixelshader9.c
index d567bcb4a0b..ac204ff5785 100644
--- a/src/gallium/state_trackers/nine/pixelshader9.c
+++ b/src/gallium/state_trackers/nine/pixelshader9.c
@@ -98,8 +98,7 @@ NinePixelShader9_dtor( struct NinePixelShader9 *This )
}
nine_shader_variants_free(&This->variant);
- if (This->byte_code.tokens)
- FREE((void *)This->byte_code.tokens); /* const_cast */
+ FREE((void *)This->byte_code.tokens); /* const_cast */
FREE(This->lconstf.data);
FREE(This->lconstf.ranges);
diff --git a/src/gallium/state_trackers/nine/stateblock9.c b/src/gallium/state_trackers/nine/stateblock9.c
index cb096c7fc1a..36b5e7773ca 100644
--- a/src/gallium/state_trackers/nine/stateblock9.c
+++ b/src/gallium/state_trackers/nine/stateblock9.c
@@ -60,12 +60,12 @@ NineStateBlock9_dtor( struct NineStateBlock9 *This )
nine_state_clear(state, FALSE);
- if (state->vs_const_f) FREE(state->vs_const_f);
- if (state->ps_const_f) FREE(state->ps_const_f);
+ FREE(state->vs_const_f);
+ FREE(state->ps_const_f);
- if (state->ff.light) FREE(state->ff.light);
+ FREE(state->ff.light);
- if (state->ff.transform) FREE(state->ff.transform);
+ FREE(state->ff.transform);
if (This->state.changed.ps_const_f) {
for (r = This->state.changed.ps_const_f; r->next; r = r->next);
diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c
index a7868ca3aa3..bf87aaf042e 100644
--- a/src/gallium/state_trackers/nine/swapchain9.c
+++ b/src/gallium/state_trackers/nine/swapchain9.c
@@ -177,7 +177,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
} else if (mode) {
This->mode = malloc(sizeof(D3DDISPLAYMODEEX));
memcpy(This->mode, mode, sizeof(D3DDISPLAYMODEEX));
- } else if (This->mode) {
+ } else {
free(This->mode);
This->mode = NULL;
}
diff --git a/src/gallium/state_trackers/nine/vertexdeclaration9.c b/src/gallium/state_trackers/nine/vertexdeclaration9.c
index 49a60e35b1e..4aea1169be3 100644
--- a/src/gallium/state_trackers/nine/vertexdeclaration9.c
+++ b/src/gallium/state_trackers/nine/vertexdeclaration9.c
@@ -220,12 +220,9 @@ NineVertexDeclaration9_ctor( struct NineVertexDeclaration9 *This,
void
NineVertexDeclaration9_dtor( struct NineVertexDeclaration9 *This )
{
- if (This->decls)
- FREE(This->decls);
- if (This->elems)
- FREE(This->elems);
- if (This->usage_map)
- FREE(This->usage_map);
+ FREE(This->decls);
+ FREE(This->elems);
+ FREE(This->usage_map);
NineUnknown_dtor(&This->base);
}
diff --git a/src/gallium/state_trackers/nine/vertexshader9.c b/src/gallium/state_trackers/nine/vertexshader9.c
index d8507b5cccc..3d40d60c062 100644
--- a/src/gallium/state_trackers/nine/vertexshader9.c
+++ b/src/gallium/state_trackers/nine/vertexshader9.c
@@ -105,8 +105,7 @@ NineVertexShader9_dtor( struct NineVertexShader9 *This )
}
nine_shader_variants_free(&This->variant);
- if (This->byte_code.tokens)
- FREE((void *)This->byte_code.tokens); /* const_cast */
+ FREE((void *)This->byte_code.tokens); /* const_cast */
FREE(This->lconstf.data);
FREE(This->lconstf.ranges);