aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/egl/common
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2012-09-04 23:33:28 -0700
committerMatt Turner <[email protected]>2012-09-05 22:28:50 -0700
commitb6109de34f04747ed2937a2e63c1f53740202d3e (patch)
tree6578024b65adc9dc2bc3bd4a23cf44f29808b3b2 /src/gallium/state_trackers/egl/common
parentda3282b6e2f374b88daf09f7f3ba5b05af45f51a (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 <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/egl/common')
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 239be6129e8..86abaebd70e 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -169,8 +169,7 @@ egl_g3d_add_screens(_EGLDriver *drv, _EGLDisplay *dpy)
native_connectors =
gdpy->native->modeset->get_connectors(gdpy->native, &num_connectors, NULL);
if (!num_connectors) {
- if (native_connectors)
- FREE(native_connectors);
+ FREE(native_connectors);
return;
}
@@ -184,8 +183,7 @@ egl_g3d_add_screens(_EGLDriver *drv, _EGLDisplay *dpy)
native_modes =
gdpy->native->modeset->get_modes(gdpy->native, nconn, &num_modes);
if (!num_modes) {
- if (native_modes)
- FREE(native_modes);
+ FREE(native_modes);
continue;
}
@@ -428,8 +426,7 @@ egl_g3d_add_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint id)
native_configs = gdpy->native->get_configs(gdpy->native, &num_configs);
if (!num_configs) {
- if (native_configs)
- FREE(native_configs);
+ FREE(native_configs);
return id;
}