diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2016-03-11 20:16:27 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2016-03-11 20:16:27 +0000 |
commit | ec639ecbdf49731a0bec26240efb76eb203087bc (patch) | |
tree | 0e44e371fa9c25209ef3fe035856a63b385a5817 /libs/tgl/docs/event-old.h | |
parent | 7c63d57169b30a5397fb8e1d0929eec600372652 (diff) |
tgl cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@16467 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'libs/tgl/docs/event-old.h')
-rw-r--r-- | libs/tgl/docs/event-old.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libs/tgl/docs/event-old.h b/libs/tgl/docs/event-old.h new file mode 100644 index 0000000000..b920e68f02 --- /dev/null +++ b/libs/tgl/docs/event-old.h @@ -0,0 +1,48 @@ +#ifndef __EVENT_OLD_H__ +#define __EVENT_OLD_H__ + +#include <assert.h> +#include <stdlib.h> + +#define BEV_EVENT_READ EVBUFFER_READ +#define BEV_EVENT_WRITE EVBUFFER_WRITE +#define BEV_EVENT_EOF EVBUFFER_EOF +#define BEV_EVENT_ERROR EVBUFFER_ERROR +#define BEV_EVENT_TIMEOUT EVBUFFER_TIMEOUT + +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) __attribute__ ((unused)); +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 (*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) __attribute__ ((unused)); +static inline struct event *evtimer_new (struct event_base *base, void(*callback)(int, short, void *), void *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) __attribute__ ((unused)); +static void event_free (struct event *ev) { + event_del (ev); + free (ev); +} + +static struct bufferevent *bufferevent_socket_new (struct event_base *base, int fd, int flags) __attribute__ ((unused)); +static struct bufferevent *bufferevent_socket_new (struct event_base *base, int fd, int flags) { + assert (!flags); + struct bufferevent *bev = bufferevent_new(fd, 0, 0, 0, 0); + bufferevent_base_set (base, bev); + return bev; +} + +static inline void *event_get_callback_arg(const struct event *ev) { + return ev->ev_arg; +} +#endif |