tchwso: util.c refactoring - wmutils - X windows manipulation utilities
 (HTM) git clone git://z3bra.org/wmutils
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 9552b0d32a7b47e59dcf263c10794dbb11e1f2c5
 (DIR) parent 86d98bdd2df7ae4f0fc2166cd98668e102ef2920
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Tue,  9 Dec 2014 12:27:23 +0100
       
       chwso: util.c refactoring
       
       Diffstat:
         M chwso.c                             |      17 ++++-------------
       
       1 file changed, 4 insertions(+), 13 deletions(-)
       ---
 (DIR) diff --git a/chwso.c b/chwso.c
       t@@ -20,10 +20,10 @@
        #include <err.h>
        
        #include "arg.h"
       +#include "util.h"
        
        static xcb_connection_t          *conn;
        
       -static void cleanup  (void);
        static void usage    (char *);
        static void stack    (xcb_window_t, uint32_t[1]);
        
       t@@ -35,13 +35,6 @@ usage (char *name)
        }
        
        static void
       -cleanup (void)
       -{
       -        if (conn)
       -                xcb_disconnect(conn);
       -}
       -
       -static void
        stack (xcb_window_t win, uint32_t values[1])
        {
                xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_STACK_MODE, values);
       t@@ -57,10 +50,7 @@ main (int argc, char **argv)
                if (argc != 3)
                        usage(argv[0]);
        
       -        atexit(cleanup);
       -        if (xcb_connection_has_error(conn = xcb_connect(NULL, NULL)))
       -                errx(1, "error connecting to X");
       -
       +        init_xcb(&conn);
        
                win = strtoul(argv[2], NULL, 16);
                if (!win)
       t@@ -76,6 +66,7 @@ main (int argc, char **argv)
                stack(win, values);
                xcb_flush(conn);
        
       +        kill_xcb(&conn);
       +
                return 0;
        }
       -