[waffle] [PATCH 04/13] all: remove 'self' NULL check from *_display_destroy()
Emil Velikov
emil.l.velikov at gmail.com
Mon May 16 10:54:40 UTC 2016
From: Emil Velikov <emil.velikov at collabora.com>
Analogous to previous commit
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
src/waffle/android/droid_display.c | 3 ---
src/waffle/cgl/cgl_display.m | 3 ---
src/waffle/gbm/wgbm_display.c | 8 ++------
src/waffle/glx/glx_display.c | 7 ++-----
src/waffle/nacl/nacl_display.c | 7 ++-----
src/waffle/wayland/wayland_display.c | 7 ++-----
src/waffle/wgl/wgl_display.c | 3 ---
src/waffle/x11/x11_display.c | 2 --
src/waffle/xegl/xegl_display.c | 7 ++-----
9 files changed, 10 insertions(+), 37 deletions(-)
diff --git a/src/waffle/android/droid_display.c b/src/waffle/android/droid_display.c
index 3f39739..46cfb9d 100644
--- a/src/waffle/android/droid_display.c
+++ b/src/waffle/android/droid_display.c
@@ -69,9 +69,6 @@ droid_display_disconnect(struct wcore_display *wc_self)
struct droid_display *self = droid_display(wc_self);
bool ok = true;
- if (!self)
- return true;
-
if (self->pSFContainer)
droid_deinit_gl(self->pSFContainer);
diff --git a/src/waffle/cgl/cgl_display.m b/src/waffle/cgl/cgl_display.m
index 015ca32..3ed8e5d 100644
--- a/src/waffle/cgl/cgl_display.m
+++ b/src/waffle/cgl/cgl_display.m
@@ -36,9 +36,6 @@ cgl_display_destroy(struct wcore_display *wc_self)
struct cgl_display *self = cgl_display(wc_self);
bool ok = true;
- if (!self)
- return ok;
-
ok &= wcore_display_teardown(&self->wcore);
free(self);
return ok;
diff --git a/src/waffle/gbm/wgbm_display.c b/src/waffle/gbm/wgbm_display.c
index 5c8af29..e8dc6ea 100644
--- a/src/waffle/gbm/wgbm_display.c
+++ b/src/waffle/gbm/wgbm_display.c
@@ -46,14 +46,10 @@ wgbm_display_destroy(struct wcore_display *wc_self)
struct wgbm_display *self = wgbm_display(wc_self);
struct wcore_platform *wc_plat = wc_self->platform;
struct wgbm_platform *plat = wgbm_platform(wegl_platform(wc_plat));
- bool ok = true;
+ bool ok;
int fd;
- if (!self)
- return ok;
-
-
- ok &= wegl_display_teardown(&self->wegl);
+ ok = wegl_display_teardown(&self->wegl);
if (self->gbm_device) {
fd = plat->gbm_device_get_fd(self->gbm_device);
diff --git a/src/waffle/glx/glx_display.c b/src/waffle/glx/glx_display.c
index 0c6851d..0e8da35 100644
--- a/src/waffle/glx/glx_display.c
+++ b/src/waffle/glx/glx_display.c
@@ -37,12 +37,9 @@ bool
glx_display_destroy(struct wcore_display *wc_self)
{
struct glx_display *self = glx_display(wc_self);
- bool ok = true;
-
- if (!self)
- return ok;
+ bool ok;
- ok &= x11_display_teardown(&self->x11);
+ ok = x11_display_teardown(&self->x11);
ok &= wcore_display_teardown(&self->wcore);
free(self);
return ok;
diff --git a/src/waffle/nacl/nacl_display.c b/src/waffle/nacl/nacl_display.c
index 7e18ba3..d91fb2e 100644
--- a/src/waffle/nacl/nacl_display.c
+++ b/src/waffle/nacl/nacl_display.c
@@ -31,12 +31,9 @@ bool
nacl_display_destroy(struct wcore_display *wc_self)
{
struct nacl_display *self = nacl_display(wc_self);
- bool ok = true;
-
- if (!self)
- return ok;
+ bool ok;
- ok &= wcore_display_teardown(&self->wcore);
+ ok = wcore_display_teardown(&self->wcore);
free(self);
return ok;
diff --git a/src/waffle/wayland/wayland_display.c b/src/waffle/wayland/wayland_display.c
index e2d59a8..96e7a4d 100644
--- a/src/waffle/wayland/wayland_display.c
+++ b/src/waffle/wayland/wayland_display.c
@@ -45,12 +45,9 @@ bool
wayland_display_destroy(struct wcore_display *wc_self)
{
struct wayland_display *self = wayland_display(wc_self);
- bool ok = true;
-
- if (!self)
- return ok;
+ bool ok;
- ok &= wegl_display_teardown(&self->wegl);
+ ok = wegl_display_teardown(&self->wegl);
if (self->wl_display)
wl_display_disconnect(self->wl_display);
diff --git a/src/waffle/wgl/wgl_display.c b/src/waffle/wgl/wgl_display.c
index c0b547a..ee5abc5 100644
--- a/src/waffle/wgl/wgl_display.c
+++ b/src/waffle/wgl/wgl_display.c
@@ -40,9 +40,6 @@ wgl_display_destroy(struct wcore_display *wc_self)
struct wgl_display *self = wgl_display(wc_self);
bool ok = true;
- if (!self)
- return true;
-
if (self->hWnd) {
if (self->hglrc) {
ok &= wglDeleteContext(self->hglrc);
diff --git a/src/waffle/x11/x11_display.c b/src/waffle/x11/x11_display.c
index 8a3524d..bdf223c 100644
--- a/src/waffle/x11/x11_display.c
+++ b/src/waffle/x11/x11_display.c
@@ -58,8 +58,6 @@ x11_display_teardown(struct x11_display *self)
{
int error = 0;
- assert(self);
-
if (!self->xlib)
return !error;
diff --git a/src/waffle/xegl/xegl_display.c b/src/waffle/xegl/xegl_display.c
index a1da480..fb57268 100644
--- a/src/waffle/xegl/xegl_display.c
+++ b/src/waffle/xegl/xegl_display.c
@@ -35,12 +35,9 @@ bool
xegl_display_destroy(struct wcore_display *wc_self)
{
struct xegl_display *self = xegl_display(wc_self);
- bool ok = true;
-
- if (!self)
- return ok;
+ bool ok;
- ok &= wegl_display_teardown(&self->wegl);
+ ok = wegl_display_teardown(&self->wegl);
ok &= x11_display_teardown(&self->x11);
free(self);
return ok;
--
2.6.2
More information about the waffle
mailing list