diff options
author | Matt Turner <[email protected]> | 2012-09-04 23:33:28 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2012-09-05 22:28:50 -0700 |
commit | b6109de34f04747ed2937a2e63c1f53740202d3e (patch) | |
tree | 6578024b65adc9dc2bc3bd4a23cf44f29808b3b2 /src/gallium/state_trackers/egl/wayland | |
parent | da3282b6e2f374b88daf09f7f3ba5b05af45f51a (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/wayland')
-rw-r--r-- | src/gallium/state_trackers/egl/wayland/native_drm.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/egl/wayland/native_shm.c | 3 |
2 files changed, 3 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c b/src/gallium/state_trackers/egl/wayland/native_drm.c index c6f61978ab0..7255c8fc9e2 100644 --- a/src/gallium/state_trackers/egl/wayland/native_drm.c +++ b/src/gallium/state_trackers/egl/wayland/native_drm.c @@ -73,10 +73,8 @@ wayland_drm_display_destroy(struct native_display *ndpy) if (drmdpy->wl_drm) wl_drm_destroy(drmdpy->wl_drm); - if (drmdpy->device_name) - FREE(drmdpy->device_name); - if (drmdpy->base.configs) - FREE(drmdpy->base.configs); + FREE(drmdpy->device_name); + FREE(drmdpy->base.configs); if (drmdpy->base.own_dpy) wl_display_disconnect(drmdpy->base.dpy); diff --git a/src/gallium/state_trackers/egl/wayland/native_shm.c b/src/gallium/state_trackers/egl/wayland/native_shm.c index 574ffce4b66..643bb929af2 100644 --- a/src/gallium/state_trackers/egl/wayland/native_shm.c +++ b/src/gallium/state_trackers/egl/wayland/native_shm.c @@ -63,8 +63,7 @@ wayland_shm_display_destroy(struct native_display *ndpy) { struct wayland_shm_display *shmdpy = wayland_shm_display(ndpy); - if (shmdpy->base.configs) - FREE(shmdpy->base.configs); + FREE(shmdpy->base.configs); if (shmdpy->base.own_dpy) wl_display_disconnect(shmdpy->base.dpy); |