Commit d28bb33f authored by Vysheng's avatar Vysheng

Fixes for old libevent

parent d60ecd75
...@@ -4,13 +4,17 @@ ...@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment