[waffle] [PATCH 01/13] x11: straighten code flow

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


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

Having goto statements jump over each other makes the code harder/more
annoying to read.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/waffle/x11/x11_window.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/waffle/x11/x11_window.c b/src/waffle/x11/x11_window.c
index 308d4ce..5df4839 100644
--- a/src/waffle/x11/x11_window.c
+++ b/src/waffle/x11/x11_window.c
@@ -79,7 +79,6 @@ x11_window_init(struct x11_window *self,
     assert(self);
     assert(dpy);
 
-    bool ok = true;
     xcb_connection_t *conn = dpy->xcb;
 
     const xcb_setup_t *setup = xcb_get_setup(conn);
@@ -157,10 +156,9 @@ x11_window_init(struct x11_window *self,
 
     self->display = dpy;
     self->xcb = window;
-    goto end;
+    return true;
 
 error:
-    ok = false;
 
     if (colormap)
         xcb_free_colormap(conn, colormap);
@@ -168,8 +166,7 @@ error:
     if (window)
         xcb_destroy_window(conn, window);
 
-end:
-    return ok;
+    return false;
 }
 
 bool
-- 
2.6.2



More information about the waffle mailing list