summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/egl/x11
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/x11
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/x11')
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c9
-rw-r--r--src/gallium/state_trackers/egl/x11/native_ximage.c3
2 files changed, 4 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 70ae0f98443..a989f9e9108 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -260,8 +260,7 @@ dri2_surface_get_buffers(struct native_surface *nsurf, uint buffer_mask)
dri2surf->server_stamp++;
dri2surf->client_stamp = dri2surf->server_stamp;
- if (dri2surf->last_xbufs)
- FREE(dri2surf->last_xbufs);
+ FREE(dri2surf->last_xbufs);
dri2surf->last_xbufs = xbufs;
dri2surf->last_num_xbufs = num_outs;
}
@@ -432,8 +431,7 @@ dri2_surface_destroy(struct native_surface *nsurf)
struct dri2_surface *dri2surf = dri2_surface(nsurf);
int i;
- if (dri2surf->last_xbufs)
- FREE(dri2surf->last_xbufs);
+ FREE(dri2surf->last_xbufs);
for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++) {
struct pipe_resource *ptex = dri2surf->textures[i];
@@ -752,8 +750,7 @@ dri2_display_destroy(struct native_display *ndpy)
{
struct dri2_display *dri2dpy = dri2_display(ndpy);
- if (dri2dpy->configs)
- FREE(dri2dpy->configs);
+ FREE(dri2dpy->configs);
if (dri2dpy->base.screen)
dri2dpy->base.screen->destroy(dri2dpy->base.screen);
diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c
index ae9c3b21356..4f09e4627c3 100644
--- a/src/gallium/state_trackers/egl/x11/native_ximage.c
+++ b/src/gallium/state_trackers/egl/x11/native_ximage.c
@@ -511,8 +511,7 @@ ximage_display_destroy(struct native_display *ndpy)
{
struct ximage_display *xdpy = ximage_display(ndpy);
- if (xdpy->configs)
- FREE(xdpy->configs);
+ FREE(xdpy->configs);
ndpy_uninit(ndpy);