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/auxiliary/util | |
parent | da3282b6e2f374b88daf09f7f3ba5b05af45f51a (diff) | |
download | external_mesa3d-b6109de34f04747ed2937a2e63c1f53740202d3e.zip external_mesa3d-b6109de34f04747ed2937a2e63c1f53740202d3e.tar.gz external_mesa3d-b6109de34f04747ed2937a2e63c1f53740202d3e.tar.bz2 |
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/auxiliary/util')
-rw-r--r-- | src/gallium/auxiliary/util/u_draw_quad.c | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_format.c | 8 |
2 files changed, 3 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/util/u_draw_quad.c b/src/gallium/auxiliary/util/u_draw_quad.c index 469c874..81c4f10 100644 --- a/src/gallium/auxiliary/util/u_draw_quad.c +++ b/src/gallium/auxiliary/util/u_draw_quad.c @@ -151,6 +151,5 @@ out: if (vbuf) pipe_resource_reference(&vbuf, NULL); - if (v) - FREE(v); + FREE(v); } diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c index 6f45298..a41c468 100644 --- a/src/gallium/auxiliary/util/u_format.c +++ b/src/gallium/auxiliary/util/u_format.c @@ -618,13 +618,9 @@ util_format_translate(enum pipe_format dst_format, src_row += src_step; } - if (tmp_s) { - FREE(tmp_s); - } + FREE(tmp_s); - if (tmp_z) { - FREE(tmp_z); - } + FREE(tmp_z); return; } |