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

Emil Velikov emil.l.velikov at gmail.com
Mon May 16 10:54:43 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/cgl/cgl_config.m   | 11 +++--------
 src/waffle/egl/wegl_config.c  |  7 ++-----
 src/waffle/glx/glx_config.c   |  7 ++-----
 src/waffle/nacl/nacl_config.c |  7 ++-----
 src/waffle/wgl/wgl_config.c   |  3 ---
 5 files changed, 9 insertions(+), 26 deletions(-)

diff --git a/src/waffle/cgl/cgl_config.m b/src/waffle/cgl/cgl_config.m
index 898ee24..fdab9a8 100644
--- a/src/waffle/cgl/cgl_config.m
+++ b/src/waffle/cgl/cgl_config.m
@@ -45,18 +45,13 @@
 bool
 cgl_config_destroy(struct wcore_config *wc_self)
 {
-    struct cgl_config *self;
-    bool ok = true;
-
-    if (wc_self == NULL)
-        return ok;
-
-    self = cgl_config(wc_self);
+    struct cgl_config *self = cgl_config(wc_self);
+    bool ok;
 
     if (self->pixel_format)
         CGLReleasePixelFormat(self->pixel_format);
 
-    ok &= wcore_config_teardown(wc_self);
+    ok = wcore_config_teardown(wc_self);
     free(self);
     return ok;
 }
diff --git a/src/waffle/egl/wegl_config.c b/src/waffle/egl/wegl_config.c
index 08e06fb..6ffde4e 100644
--- a/src/waffle/egl/wegl_config.c
+++ b/src/waffle/egl/wegl_config.c
@@ -262,12 +262,9 @@ bool
 wegl_config_destroy(struct wcore_config *wc_config)
 {
     struct wegl_config *config = wegl_config(wc_config);
-    bool result = true;
+    bool result;
 
-    if (!config)
-        return true;
-
-    result &= wcore_config_teardown(wc_config);
+    result = wcore_config_teardown(wc_config);
     free(config);
     return result;
 }
diff --git a/src/waffle/glx/glx_config.c b/src/waffle/glx/glx_config.c
index 7f3d3ed..5de70e1 100644
--- a/src/waffle/glx/glx_config.c
+++ b/src/waffle/glx/glx_config.c
@@ -40,12 +40,9 @@
 bool
 glx_config_destroy(struct wcore_config *wc_self)
 {
-    bool ok = true;
-
-    if (wc_self == NULL)
-        return ok;
+    bool ok;
 
-    ok &= wcore_config_teardown(wc_self);
+    ok = wcore_config_teardown(wc_self);
     free(glx_config(wc_self));
     return ok;
 }
diff --git a/src/waffle/nacl/nacl_config.c b/src/waffle/nacl/nacl_config.c
index 668657b..e078b92 100644
--- a/src/waffle/nacl/nacl_config.c
+++ b/src/waffle/nacl/nacl_config.c
@@ -33,12 +33,9 @@
 bool
 nacl_config_destroy(struct wcore_config *wc_self)
 {
-    bool ok = true;
-
-    if (wc_self == NULL)
-        return ok;
+    bool ok;
 
-    ok &= wcore_config_teardown(wc_self);
+    ok = wcore_config_teardown(wc_self);
     free(nacl_config(wc_self));
     return ok;
 }
diff --git a/src/waffle/wgl/wgl_config.c b/src/waffle/wgl/wgl_config.c
index a912bba..3c793f8 100644
--- a/src/waffle/wgl/wgl_config.c
+++ b/src/waffle/wgl/wgl_config.c
@@ -44,9 +44,6 @@ wgl_config_destroy(struct wcore_config *wc_self)
     struct wgl_config *self = wgl_config(wc_self);
     bool ok = true;
 
-    if (!self)
-        return true;
-
     if (self->window)
         ok &= wgl_window_priv_destroy(&self->window->wcore);
 
-- 
2.6.2



More information about the waffle mailing list