[waffle] [PATCH 05/13] all: remove 'self' NULL check from *_window_destroy()
Emil Velikov
emil.l.velikov at gmail.com
Mon May 16 10:54:41 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_window.c | 11 +++--------
src/waffle/cgl/cgl_window.m | 7 ++-----
src/waffle/gbm/wgbm_window.c | 7 ++-----
src/waffle/glx/glx_window.c | 7 ++-----
src/waffle/nacl/nacl_window.c | 7 ++-----
src/waffle/wayland/wayland_window.c | 7 ++-----
src/waffle/wgl/wgl_window.c | 4 ----
src/waffle/x11/x11_window.c | 2 --
src/waffle/xegl/xegl_window.c | 7 ++-----
9 files changed, 15 insertions(+), 44 deletions(-)
diff --git a/src/waffle/android/droid_window.c b/src/waffle/android/droid_window.c
index 048a2bb..b11d079 100644
--- a/src/waffle/android/droid_window.c
+++ b/src/waffle/android/droid_window.c
@@ -85,15 +85,10 @@ bool
droid_window_destroy(struct wcore_window *wc_self)
{
struct droid_window *self = droid_window(wc_self);
- struct droid_display *dpy;
- bool ok = true;
-
- if (!self)
- return ok;
-
- dpy = droid_display(self->wegl.wcore.display);
+ struct droid_display *dpy = droid_display(self->wegl.wcore.display);
+ bool ok;
- ok &= wegl_window_teardown(&self->wegl);
+ ok = wegl_window_teardown(&self->wegl);
droid_destroy_surface(dpy->pSFContainer, self->pANWContainer);
free(self);
return ok;
diff --git a/src/waffle/cgl/cgl_window.m b/src/waffle/cgl/cgl_window.m
index 91273c5..cde2e7c 100644
--- a/src/waffle/cgl/cgl_window.m
+++ b/src/waffle/cgl/cgl_window.m
@@ -36,10 +36,7 @@ bool
cgl_window_destroy(struct wcore_window *wc_self)
{
struct cgl_window *self = cgl_window(wc_self);
- bool ok = true;
-
- if (!self)
- return ok;
+ bool ok;
if (self->gl_view)
[self->gl_view release];
@@ -47,7 +44,7 @@ cgl_window_destroy(struct wcore_window *wc_self)
if (self->ns_window)
[self->ns_window release];
- ok &= wcore_window_teardown(&self->wcore);
+ ok = wcore_window_teardown(&self->wcore);
free(self);
return ok;
}
diff --git a/src/waffle/gbm/wgbm_window.c b/src/waffle/gbm/wgbm_window.c
index 313304b..4c652c7 100644
--- a/src/waffle/gbm/wgbm_window.c
+++ b/src/waffle/gbm/wgbm_window.c
@@ -46,12 +46,9 @@ wgbm_window_destroy(struct wcore_window *wc_self)
struct wcore_platform *wc_plat = wc_self->display->platform;
struct wgbm_platform *plat = wgbm_platform(wegl_platform(wc_plat));
struct wgbm_window *self = wgbm_window(wc_self);
- bool ok = true;
-
- if (!self)
- return ok;
+ bool ok;
- ok &= wegl_window_teardown(&self->wegl);
+ ok = wegl_window_teardown(&self->wegl);
plat->gbm_surface_destroy(self->gbm_surface);
free(self);
return ok;
diff --git a/src/waffle/glx/glx_window.c b/src/waffle/glx/glx_window.c
index 52efb61..0708347 100644
--- a/src/waffle/glx/glx_window.c
+++ b/src/waffle/glx/glx_window.c
@@ -39,12 +39,9 @@ bool
glx_window_destroy(struct wcore_window *wc_self)
{
struct glx_window *self = glx_window(wc_self);
- bool ok = true;
-
- if (!wc_self)
- return ok;
+ bool ok;
- ok &= x11_window_teardown(&self->x11);
+ ok = x11_window_teardown(&self->x11);
ok &= wcore_window_teardown(wc_self);
free(self);
return ok;
diff --git a/src/waffle/nacl/nacl_window.c b/src/waffle/nacl/nacl_window.c
index 1191f51..ed704c5 100644
--- a/src/waffle/nacl/nacl_window.c
+++ b/src/waffle/nacl/nacl_window.c
@@ -34,12 +34,9 @@ bool
nacl_window_destroy(struct wcore_window *wc_self)
{
struct nacl_window *self = nacl_window(wc_self);
- bool ok = true;
-
- if (!wc_self)
- return ok;
+ bool ok;
- ok &= wcore_window_teardown(wc_self);
+ ok = wcore_window_teardown(wc_self);
free(self);
return ok;
}
diff --git a/src/waffle/wayland/wayland_window.c b/src/waffle/wayland/wayland_window.c
index 2c4ebc8..c734f57 100644
--- a/src/waffle/wayland/wayland_window.c
+++ b/src/waffle/wayland/wayland_window.c
@@ -50,12 +50,9 @@ wayland_window_destroy(struct wcore_window *wc_self)
struct wcore_platform *wc_plat = wc_self->display->platform;
struct wayland_platform *plat = wayland_platform(wegl_platform(wc_plat));
struct wayland_window *self = wayland_window(wc_self);
- bool ok = true;
-
- if (!self)
- return ok;
+ bool ok;
- ok &= wegl_window_teardown(&self->wegl);
+ ok = wegl_window_teardown(&self->wegl);
if (self->wl_window)
plat->wl_egl_window_destroy(self->wl_window);
diff --git a/src/waffle/wgl/wgl_window.c b/src/waffle/wgl/wgl_window.c
index 316fb1d..897ec39 100644
--- a/src/waffle/wgl/wgl_window.c
+++ b/src/waffle/wgl/wgl_window.c
@@ -37,7 +37,6 @@ wgl_window_destroy(struct wcore_window *wc_self)
{
struct wgl_window *self = wgl_window(wc_self);
- assert(self);
assert(self->hWnd);
self->created = false;
@@ -51,9 +50,6 @@ wgl_window_priv_destroy(struct wcore_window *wc_self)
struct wgl_window *self = wgl_window(wc_self);
bool ok = true;
- if (!self)
- return true;
-
if (self->hWnd) {
if (self->hDC) {
ok &= ReleaseDC(self->hWnd, self->hDC);
diff --git a/src/waffle/x11/x11_window.c b/src/waffle/x11/x11_window.c
index 5df4839..1535431 100644
--- a/src/waffle/x11/x11_window.c
+++ b/src/waffle/x11/x11_window.c
@@ -175,8 +175,6 @@ x11_window_teardown(struct x11_window *self)
xcb_void_cookie_t cookie;
xcb_generic_error_t *error;
- assert(self);
-
if (!self->xcb)
return true;
diff --git a/src/waffle/xegl/xegl_window.c b/src/waffle/xegl/xegl_window.c
index cd2be46..66f30b1 100644
--- a/src/waffle/xegl/xegl_window.c
+++ b/src/waffle/xegl/xegl_window.c
@@ -42,12 +42,9 @@ bool
xegl_window_destroy(struct wcore_window *wc_self)
{
struct xegl_window *self = xegl_window(wc_self);
- bool ok = true;
-
- if (!self)
- return ok;
+ bool ok;
- ok &= wegl_window_teardown(&self->wegl);
+ ok = wegl_window_teardown(&self->wegl);
ok &= x11_window_teardown(&self->x11);
free(self);
return ok;
--
2.6.2
More information about the waffle
mailing list