tchwb: 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 86d98bdd2df7ae4f0fc2166cd98668e102ef2920
 (DIR) parent 4d8d7118beb336f0bf9e18cdbcb415a49e249b7a
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Tue,  9 Dec 2014 12:25:37 +0100
       
       chwb: util.c refactoring
       
       Diffstat:
         M chwb.c                              |      16 ++++------------
       
       1 file changed, 4 insertions(+), 12 deletions(-)
       ---
 (DIR) diff --git a/chwb.c b/chwb.c
       t@@ -20,21 +20,14 @@
        #include <err.h>
        
        #include "arg.h"
       +#include "util.h"
        
        static xcb_connection_t *conn;
        
       -static void cleanup    (void);
        static void usage      (char *name);
        static void setborder  (int, int, xcb_window_t);
        
        static void
       -cleanup (void)
       -{
       -        if (conn)
       -                xcb_disconnect(conn);
       -}
       -
       -static void
        usage (char *name)
        {
                fprintf(stderr, "usage: %s <-sc ...> <wid> [wid...]\n", name);
       t@@ -69,10 +62,8 @@ main (int argc, char **argv)
        {
                char *argv0;
                int color,bw;
       -        atexit(cleanup);
        
       -        if (xcb_connection_has_error(conn = xcb_connect(NULL, NULL)))
       -                errx(1, "error connecting to X");
       +        init_xcb(&conn);
        
                color = bw = -1;
        
       t@@ -94,8 +85,9 @@ main (int argc, char **argv)
                while (*argv)
                        setborder(bw, color, strtoul(*argv++, NULL, 16));
        
       -
                xcb_flush(conn);
        
       +        kill_xcb(&conn);
       +
                return 0;
        }