Remove useless checks for NULL before freeing
authorMatt Turner <mattst88@gmail.com>
Wed, 5 Sep 2012 06:33:28 +0000 (23:33 -0700)
committerMatt Turner <mattst88@gmail.com>
Thu, 6 Sep 2012 05:28:50 +0000 (22:28 -0700)
commitb6109de34f04747ed2937a2e63c1f53740202d3e
tree6578024b65adc9dc2bc3bd4a23cf44f29808b3b2
parentda3282b6e2f374b88daf09f7f3ba5b05af45f51a
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>
28 files changed:
src/gallium/auxiliary/draw/draw_gs.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
src/gallium/auxiliary/tgsi/tgsi_exec.c
src/gallium/auxiliary/util/u_draw_quad.c
src/gallium/auxiliary/util/u_format.c
src/gallium/drivers/i915/i915_resource_texture.c
src/gallium/drivers/i915/i915_state.c
src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/nv30/nvfx_fragprog.c
src/gallium/drivers/nv50/nv50_program.c
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/nvc0/nvc0_program.c
src/gallium/drivers/nvc0/nvc0_screen.c
src/gallium/drivers/r300/r300_screen_buffer.c
src/gallium/drivers/r300/r300_state.c
src/gallium/state_trackers/egl/common/egl_g3d.c
src/gallium/state_trackers/egl/drm/modeset.c
src/gallium/state_trackers/egl/drm/native_drm.c
src/gallium/state_trackers/egl/gdi/native_gdi.c
src/gallium/state_trackers/egl/wayland/native_drm.c
src/gallium/state_trackers/egl/wayland/native_shm.c
src/gallium/state_trackers/egl/x11/native_dri2.c
src/gallium/state_trackers/egl/x11/native_ximage.c
src/gallium/state_trackers/vega/text.c
src/gallium/state_trackers/wgl/stw_device.c
src/gallium/targets/graw-xlib/graw_xlib.c
src/gallium/winsys/sw/dri/dri_sw_winsys.c