From 3f925a56d3475f623828d18ea597d7867b4fb48e Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 1 Jun 2009 21:12:13 +0200 Subject: [PATCH] Fix warning about dereferencing type-punned pointers --- src/mainx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mainx.c b/src/mainx.c index 5de87700..c0fb6581 100644 --- a/src/mainx.c +++ b/src/mainx.c @@ -343,14 +343,14 @@ int main(int argc, char *argv[], char *env[]) { if (loop == NULL) die("Could not initialize libev. Bad LIBEV_FLAGS?\n"); - ev_io xcb_watcher; - ev_io_init(&xcb_watcher, xcb_got_event, xcb_get_file_descriptor(conn), EV_READ); + struct ev_io *xcb_watcher = scalloc(sizeof(struct ev_io)); + ev_io_init(xcb_watcher, xcb_got_event, xcb_get_file_descriptor(conn), EV_READ); /* Call the handler to work all events which arrived before the libev-stuff was set up */ - xcb_got_event(NULL, &xcb_watcher, 0); + xcb_got_event(NULL, xcb_watcher, 0); /* Enter the libev eventloop */ - ev_io_start(loop, &xcb_watcher); + ev_io_start(loop, xcb_watcher); ev_loop(loop, 0); /* not reached */ -- 2.39.5