Fixes for old libevent

This commit is contained in:
Vysheng 2014-09-08 16:40:35 +04:00
parent d60ecd751f
commit d28bb33fb2

View File

@ -4,13 +4,17 @@
typedef int evutil_socket_t; 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) { 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)); struct event *ev = malloc (sizeof (*ev));
event_set (ev, base, fd, what, callback, arg); 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) { static inline struct event *evtimer_new (struct event_base *base, void(*callback)(int, short, void *), void *arg) {
struct event *ev = malloc (sizeof (*ec)); struct event *ev = malloc (sizeof (*ev));
evtimer_set (ev, base, callback, arg); event_set (ev, -1, 0, callback, arg);
event_base_set (base, ev);
return ev;
} }
static void event_free (struct event *ev) { static void event_free (struct event *ev) {