From d28bb33fb2cb69b7f9cea369af6fc3db7e9a9391 Mon Sep 17 00:00:00 2001 From: Vysheng Date: Mon, 8 Sep 2014 16:40:35 +0400 Subject: [PATCH] Fixes for old libevent --- event-old.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/event-old.h b/event-old.h index a41b33c..eef4df3 100644 --- a/event-old.h +++ b/event-old.h @@ -4,13 +4,17 @@ typedef int evutil_socket_t; static inline struct event *event_new (struct event_base *base, int fd, int what, void(*callback)(int, short, void *), void *arg) { - struct event *ev = malloc (sizeof (*ec)); - event_set (ev, base, fd, what, callback, arg); + struct event *ev = malloc (sizeof (*ev)); + event_set (ev, fd, what, callback, arg); + event_base_set (base, ev); + return ev; } static inline struct event *evtimer_new (struct event_base *base, void(*callback)(int, short, void *), void *arg) { - struct event *ev = malloc (sizeof (*ec)); - evtimer_set (ev, base, callback, arg); + struct event *ev = malloc (sizeof (*ev)); + event_set (ev, -1, 0, callback, arg); + event_base_set (base, ev); + return ev; } static void event_free (struct event *ev) {