From b6109de34f04747ed2937a2e63c1f53740202d3e Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Tue, 4 Sep 2012 23:33:28 -0700 Subject: 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 --- src/gallium/auxiliary/util/u_format.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/gallium/auxiliary/util/u_format.c') diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c index 6f452983592..a41c468a95d 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; } -- cgit v1.2.3