wmutils

X windows manipulation utilities
git clone git://z3bra.org/wmutils
Log | Files | Refs | LICENSE

commit 4d8d7118beb336f0bf9e18cdbcb415a49e249b7a
parent 822d777153479786803356b6f34bec3d447b45ea
Author: z3bra <willy@mailoo.org>
Date:   Tue Dec  9 12:22:58 2014

killw: util.c refactoring

Diffstat:
 killw.c | 25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/killw.c b/killw.c @@ -3,31 +3,14 @@ #include <err.h> #include <xcb/xcb.h> -static xcb_connection_t *conn; - -static void xcbinit(void); -static void cleanup(void); - -static void -xcbinit(void) -{ - conn = xcb_connect(NULL, NULL); - if (xcb_connection_has_error(conn)) - errx(1, "xcb_connect"); -} +#include "util.h" -static void -cleanup(void) -{ - if (conn != NULL) - xcb_disconnect(conn); -} +static xcb_connection_t *conn; int main(int argc, char **argv) { - atexit(cleanup); - xcbinit(); + init_xcb(&conn); /* assume remaining arguments are windows */ while (*argv) @@ -35,5 +18,7 @@ main(int argc, char **argv) xcb_flush(conn); + kill_xcb(&conn); + return 0; }