[waffle] [PATCH 05/33] api: remove double NULL check

Emil Velikov emil.l.velikov at gmail.com
Mon Jul 7 10:28:12 PDT 2014


We check if the object is NULL before appending it to the
obj_list and a second time as we append it. Drop the latter
as it makes the code more confusing than it needs to be.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/waffle/api/waffle_context.c | 2 +-
 src/waffle/api/waffle_gl_misc.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/waffle/api/waffle_context.c b/src/waffle/api/waffle_context.c
index 00649ba..ca22814 100644
--- a/src/waffle/api/waffle_context.c
+++ b/src/waffle/api/waffle_context.c
@@ -43,7 +43,7 @@ waffle_context_create(
 
     obj_list[len++] = wc_config ? &wc_config->api : NULL;
     if (wc_shared_ctx)
-        obj_list[len++] = wc_shared_ctx ? &wc_shared_ctx->api : NULL;
+        obj_list[len++] = &wc_shared_ctx->api;
 
     if (!api_check_entry(obj_list, len))
         return NULL;
diff --git a/src/waffle/api/waffle_gl_misc.c b/src/waffle/api/waffle_gl_misc.c
index 10b4da5..c746f52 100644
--- a/src/waffle/api/waffle_gl_misc.c
+++ b/src/waffle/api/waffle_gl_misc.c
@@ -90,9 +90,9 @@ waffle_make_current(
 
     obj_list[len++] = wc_dpy ? &wc_dpy->api : NULL;
     if (wc_window)
-        obj_list[len++] = wc_window ? &wc_window->api : NULL;
+        obj_list[len++] = &wc_window->api;
     if (wc_ctx)
-        obj_list[len++] = wc_ctx ? &wc_ctx->api : NULL;
+        obj_list[len++] = &wc_ctx->api;
 
     if (!api_check_entry(obj_list, len))
         return false;
-- 
2.0.0



More information about the waffle mailing list