[waffle] [PATCH 03/13] all: remove 'self' NULL check from *_platform_destroy()

Emil Velikov emil.l.velikov at gmail.com
Mon May 16 10:54:39 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

The upper layer (API) already guarantees that one cannot send NULL down
the backends, plus our ctors never call the function with NULL ptr.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/waffle/android/droid_platform.c   | 3 ---
 src/waffle/cgl/cgl_platform.m         | 3 ---
 src/waffle/gbm/wgbm_platform.c        | 3 ---
 src/waffle/glx/glx_platform.c         | 3 ---
 src/waffle/nacl/nacl_platform.c       | 3 ---
 src/waffle/wayland/wayland_platform.c | 3 ---
 src/waffle/wgl/wgl_platform.c         | 3 ---
 src/waffle/xegl/xegl_platform.c       | 3 ---
 8 files changed, 24 deletions(-)

diff --git a/src/waffle/android/droid_platform.c b/src/waffle/android/droid_platform.c
index bbf2b14..da7a8d3 100644
--- a/src/waffle/android/droid_platform.c
+++ b/src/waffle/android/droid_platform.c
@@ -46,9 +46,6 @@ droid_platform_destroy(struct wcore_platform *wc_self)
     struct droid_platform *self = droid_platform(wc_self);
     bool ok = true;
 
-    if (!self)
-        return true;
-
     if (self->linux)
         ok &= linux_platform_destroy(self->linux);
 
diff --git a/src/waffle/cgl/cgl_platform.m b/src/waffle/cgl/cgl_platform.m
index 2da0b40..e87e6cf 100644
--- a/src/waffle/cgl/cgl_platform.m
+++ b/src/waffle/cgl/cgl_platform.m
@@ -42,9 +42,6 @@ cgl_platform_destroy(struct wcore_platform *wc_self)
     struct cgl_platform *self = cgl_platform(wc_self);
     bool ok = true;
 
-    if (!self)
-        return ok;
-
     if (self->dl_gl)
         ok &= cgl_dl_close(&self->wcore);
 
diff --git a/src/waffle/gbm/wgbm_platform.c b/src/waffle/gbm/wgbm_platform.c
index 0fc0352..40f5fd1 100644
--- a/src/waffle/gbm/wgbm_platform.c
+++ b/src/waffle/gbm/wgbm_platform.c
@@ -79,9 +79,6 @@ wgbm_platform_destroy(struct wcore_platform *wc_self)
 {
     struct wgbm_platform *self = wgbm_platform(wegl_platform(wc_self));
 
-    if (!self)
-        return true;
-
     bool ok = wgbm_platform_teardown(self);
     free(self);
     return ok;
diff --git a/src/waffle/glx/glx_platform.c b/src/waffle/glx/glx_platform.c
index 4fb2eed..1f4e3fb 100644
--- a/src/waffle/glx/glx_platform.c
+++ b/src/waffle/glx/glx_platform.c
@@ -48,9 +48,6 @@ glx_platform_destroy(struct wcore_platform *wc_self)
     bool ok = true;
     int error = 0;
 
-    if (!self)
-        return true;
-
     if (self->linux)
         ok &= linux_platform_destroy(self->linux);
 
diff --git a/src/waffle/nacl/nacl_platform.c b/src/waffle/nacl/nacl_platform.c
index a3d7625..b4b326c 100644
--- a/src/waffle/nacl/nacl_platform.c
+++ b/src/waffle/nacl/nacl_platform.c
@@ -42,9 +42,6 @@ nacl_platform_destroy(struct wcore_platform *wc_self)
     struct nacl_platform *self = nacl_platform(wc_self);
     bool ok = true;
 
-    if (!self)
-        return true;
-
     ok &= wcore_platform_teardown(wc_self);
 
     nacl_container_teardown(self->nacl);
diff --git a/src/waffle/wayland/wayland_platform.c b/src/waffle/wayland/wayland_platform.c
index 2746ca1..4603643 100644
--- a/src/waffle/wayland/wayland_platform.c
+++ b/src/waffle/wayland/wayland_platform.c
@@ -56,9 +56,6 @@ wayland_platform_destroy(struct wcore_platform *wc_self)
     bool ok = true;
     int error;
 
-    if (!self)
-        return true;
-
     unsetenv("EGL_PLATFORM");
 
     if (self->linux)
diff --git a/src/waffle/wgl/wgl_platform.c b/src/waffle/wgl/wgl_platform.c
index f4649b4..cdbfd89 100644
--- a/src/waffle/wgl/wgl_platform.c
+++ b/src/waffle/wgl/wgl_platform.c
@@ -45,9 +45,6 @@ wgl_platform_destroy(struct wcore_platform *wc_self)
     struct wgl_platform *self = wgl_platform(wc_self);
     bool ok = true;
 
-    if (!self)
-        return true;
-
     if (self->dl_gl)
         ok &= wgl_dl_close(wc_self);
 
diff --git a/src/waffle/xegl/xegl_platform.c b/src/waffle/xegl/xegl_platform.c
index e36a41b..a2e7cd2 100644
--- a/src/waffle/xegl/xegl_platform.c
+++ b/src/waffle/xegl/xegl_platform.c
@@ -48,9 +48,6 @@ xegl_platform_destroy(struct wcore_platform *wc_self)
     struct xegl_platform *self = xegl_platform(wegl_platform(wc_self));
     bool ok = true;
 
-    if (!self)
-        return true;
-
     unsetenv("EGL_PLATFORM");
 
     if (self->linux)
-- 
2.6.2



More information about the waffle mailing list