summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/egl
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
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')
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c9
-rw-r--r--src/gallium/state_trackers/egl/drm/modeset.c6
-rw-r--r--src/gallium/state_trackers/egl/drm/native_drm.c6
-rw-r--r--src/gallium/state_trackers/egl/gdi/native_gdi.c3
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_drm.c6
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_shm.c3
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c9
-rw-r--r--src/gallium/state_trackers/egl/x11/native_ximage.c3
8 files changed, 15 insertions, 30 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;
}
diff --git a/src/gallium/state_trackers/egl/drm/modeset.c b/src/gallium/state_trackers/egl/drm/modeset.c
index b33323b9d60..32c0a258c6f 100644
--- a/src/gallium/state_trackers/egl/drm/modeset.c
+++ b/src/gallium/state_trackers/egl/drm/modeset.c
@@ -648,10 +648,8 @@ drm_display_fini_modeset(struct native_display *ndpy)
FREE(drmdpy->connectors);
}
- if (drmdpy->shown_surfaces) {
- FREE(drmdpy->shown_surfaces);
- drmdpy->shown_surfaces = NULL;
- }
+ FREE(drmdpy->shown_surfaces);
+ drmdpy->shown_surfaces = NULL;
if (drmdpy->saved_crtcs) {
for (i = 0; i < drmdpy->resources->count_crtcs; i++) {
diff --git a/src/gallium/state_trackers/egl/drm/native_drm.c b/src/gallium/state_trackers/egl/drm/native_drm.c
index feb1dc045bf..23fc137b834 100644
--- a/src/gallium/state_trackers/egl/drm/native_drm.c
+++ b/src/gallium/state_trackers/egl/drm/native_drm.c
@@ -123,8 +123,7 @@ drm_display_destroy(struct native_display *ndpy)
{
struct drm_display *drmdpy = drm_display(ndpy);
- if (drmdpy->config)
- FREE(drmdpy->config);
+ FREE(drmdpy->config);
drm_display_fini_modeset(&drmdpy->base);
@@ -132,8 +131,7 @@ drm_display_destroy(struct native_display *ndpy)
ndpy->screen = NULL;
ndpy_uninit(ndpy);
- if (drmdpy->device_name)
- FREE(drmdpy->device_name);
+ FREE(drmdpy->device_name);
if (drmdpy->own_gbm) {
gbm_device_destroy(&drmdpy->gbmdrm->base.base);
diff --git a/src/gallium/state_trackers/egl/gdi/native_gdi.c b/src/gallium/state_trackers/egl/gdi/native_gdi.c
index 78dbe7cca6c..7b40108884a 100644
--- a/src/gallium/state_trackers/egl/gdi/native_gdi.c
+++ b/src/gallium/state_trackers/egl/gdi/native_gdi.c
@@ -358,8 +358,7 @@ gdi_display_destroy(struct native_display *ndpy)
{
struct gdi_display *gdpy = gdi_display(ndpy);
- if (gdpy->configs)
- FREE(gdpy->configs);
+ FREE(gdpy->configs);
ndpy_uninit(ndpy);
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);
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);