commit 5d99408e12cdbf962521bb763070df63f10f6a71 Author: Nathaniel McCallum npmccallum@redhat.com Date: Tue Oct 25 16:59:34 2011 -0400
rework type handling for modules to be cleaner
src/verto-glib.c | 71 +++++++++++++++++++++++----------------------- src/verto-libev.c | 76 ++++++++++++++++++++++++++++--------------------- src/verto-libevent.c | 31 +++++++++++--------- src/verto-module.h | 24 ++++++++++----- src/verto-tevent.c | 57 ++++++++++++++++++------------------- src/verto.c | 42 +++++++++++++++------------ 6 files changed, 162 insertions(+), 139 deletions(-) --- diff --git a/src/verto-glib.c b/src/verto-glib.c index bff71ac..8598d01 100644 --- a/src/verto-glib.c +++ b/src/verto-glib.c @@ -25,6 +25,15 @@ #include <errno.h>
#include <verto-glib.h> +#define VERTO_MODULE_TYPES +typedef struct { + GMainContext *context; + GMainLoop *loop; +} verto_mod_ctx; +typedef struct { + GSource *src; + GIOChannel *chan; +} verto_mod_ev; #include <verto-module.h>
/* While glib has signal support in >=2.29, it does not support many @@ -48,22 +57,12 @@ | HAS_SIGNAL \ | VERTO_EV_TYPE_CHILD)
-typedef struct { - GMainContext *context; - GMainLoop *loop; -} glib_ev_ctx; - -typedef struct { - GSource *src; - GIOChannel *chan; -} glib_ev; - static void * glib_convert_(GMainContext *mc, GMainLoop *ml) { - glib_ev_ctx *l = NULL; + verto_mod_ctx *l = NULL;
- l = g_new0(glib_ev_ctx, 1); + l = g_new0(verto_mod_ctx, 1); if (l) { if (mc) { /* Steal references */ @@ -85,23 +84,23 @@ glib_convert_(GMainContext *mc, GMainLoop *ml) }
static void -glib_ctx_free(void *lp) +glib_ctx_free(verto_mod_ctx *ctx) { - g_main_loop_unref(((glib_ev_ctx*) lp)->loop); - g_main_context_unref(((glib_ev_ctx*) lp)->context); - g_free(lp); + g_main_loop_unref(ctx->loop); + g_main_context_unref(ctx->context); + g_free(ctx); }
static void -glib_ctx_run(void *lp) +glib_ctx_run(verto_mod_ctx *ctx) { - g_main_loop_run(((glib_ev_ctx*) lp)->loop); + g_main_loop_run(ctx->loop); }
static void -glib_ctx_run_once(void *lp) +glib_ctx_run_once(verto_mod_ctx *ctx) { - g_main_context_iteration(((glib_ev_ctx*) lp)->context, TRUE); + g_main_context_iteration(ctx->context, TRUE); }
static gboolean @@ -112,18 +111,18 @@ break_callback(gpointer loop) }
static void -glib_ctx_break(void *lp) +glib_ctx_break(verto_mod_ctx *ctx) { GSource *src = g_timeout_source_new(0); g_assert(src); - g_source_set_callback(src, break_callback, ((glib_ev_ctx*) lp)->loop, NULL); + g_source_set_callback(src, break_callback, ctx->loop, NULL); g_source_set_priority(src, G_PRIORITY_HIGH); - g_assert(g_source_attach(src, ((glib_ev_ctx*) lp)->context) != 0); + g_assert(g_source_attach(src, ctx->context) != 0); g_source_unref(src); }
static void -glib_ctx_reinitialize(void *lp) +glib_ctx_reinitialize(verto_mod_ctx *ctx) {
} @@ -136,7 +135,7 @@ glib_callback(gpointer data) return persists; }
-gboolean +static gboolean glib_callback_io(GIOChannel *source, GIOCondition condition, gpointer data) { return glib_callback(data); @@ -149,14 +148,14 @@ glib_callback_child(GPid pid, gint status, gpointer data) verto_fire(data); }
-static void * -glib_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags) +static verto_mod_ev * +glib_ctx_add(verto_mod_ctx *ctx, const verto_ev *ev, verto_ev_flag *flags) { - glib_ev *gev = NULL; + verto_mod_ev *gev = NULL; GIOCondition cond = 0; verto_ev_type type = verto_get_type(ev);
- gev = g_new0(glib_ev, 1); + gev = g_new0(verto_mod_ev, 1); if (!gev) return NULL;
@@ -221,7 +220,7 @@ glib_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags) g_source_set_priority(gev->src, G_PRIORITY_LOW);
g_source_set_can_recurse(gev->src, FALSE); - if (g_source_attach(gev->src, ((glib_ev_ctx*) ctx)->context) == 0) + if (g_source_attach(gev->src, ctx->context) == 0) goto error;
return gev; @@ -240,16 +239,16 @@ glib_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags) }
static void -glib_ctx_del(void *lp, const verto_ev *ev, void *evpriv) +glib_ctx_del(verto_mod_ctx *ctx, const verto_ev *ev, verto_mod_ev *evpriv) { if (!ev) return;
- if (((glib_ev *) evpriv)->chan) - g_io_channel_unref(((glib_ev *) evpriv)->chan); - if (((glib_ev *) evpriv)->src) { - g_source_destroy(((glib_ev *) evpriv)->src); - g_source_unref(((glib_ev *) evpriv)->src); + if (evpriv->chan) + g_io_channel_unref(evpriv->chan); + if (evpriv->src) { + g_source_destroy(evpriv->src); + g_source_unref(evpriv->src); }
g_free(evpriv); diff --git a/src/verto-libev.c b/src/verto-libev.c index 48538a3..fce9c8c 100644 --- a/src/verto-libev.c +++ b/src/verto-libev.c @@ -27,35 +27,38 @@ #include <errno.h>
#include <verto-libev.h> +#define VERTO_MODULE_TYPES +typedef struct ev_loop verto_mod_ctx; +typedef ev_watcher verto_mod_ev; #include <verto-module.h>
static void -libev_ctx_free(void *ctx) +libev_ctx_free(verto_mod_ctx *ctx) { if (ctx != EV_DEFAULT) ev_loop_destroy(ctx); }
static void -libev_ctx_run(void *ctx) +libev_ctx_run(verto_mod_ctx *ctx) { ev_run(ctx, 0); }
static void -libev_ctx_run_once(void *ctx) +libev_ctx_run_once(verto_mod_ctx *ctx) { ev_run(ctx, EVRUN_ONCE); }
static void -libev_ctx_break(void *ctx) +libev_ctx_break(verto_mod_ctx *ctx) { ev_break(ctx, EVBREAK_ONE); }
static void -libev_ctx_reinitialize(void *ctx) +libev_ctx_reinitialize(verto_mod_ctx *ctx) { ev_loop_fork(ctx); } @@ -69,26 +72,29 @@ libev_callback(EV_P_ ev_watcher *w, int revents) verto_fire(w->data); }
-#define setuptype(type, priv, ...) \ - type ## w = malloc(sizeof(ev_ ## type)); \ - if (!type ## w) \ - return NULL; \ - ev_ ## type ## _init(type ## w, (EV_CB(type, (*))) __VA_ARGS__); \ - type ## w->data = (void *) priv; \ - ev_ ## type ## _start(ctx, type ## w); \ - return type ## w - -static void * -libev_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags) +#define setuptype(type, ...) \ + w.type = malloc(sizeof(ev_ ## type)); \ + if (w.type) { \ + ev_ ## type ## _init(w.type, (EV_CB(type, (*))) __VA_ARGS__); \ + ev_ ## type ## _start(ctx, w.type); \ + } \ + break + +static verto_mod_ev * +libev_ctx_add(verto_mod_ctx *ctx, const verto_ev *ev, verto_ev_flag *flags) { - ev_io *iow = NULL; - ev_timer *timerw = NULL; - ev_idle *idlew = NULL; - ev_signal *signalw = NULL; - ev_child *childw = NULL; + union { + ev_watcher *watcher; + ev_io *io; + ev_timer *timer; + ev_idle *idle; + ev_signal *signal; + ev_child *child; + } w; ev_tstamp interval; int events = EV_NONE;
+ w.watcher = NULL; *flags |= VERTO_EV_FLAG_PERSIST; switch (verto_get_type(ev)) { case VERTO_EV_TYPE_IO: @@ -96,40 +102,44 @@ libev_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags) events |= EV_READ; if (verto_get_flags(ev) & VERTO_EV_FLAG_IO_WRITE) events |= EV_WRITE; - setuptype(io, ev, libev_callback, verto_get_fd(ev), events); + setuptype(io, libev_callback, verto_get_fd(ev), events); case VERTO_EV_TYPE_TIMEOUT: interval = ((ev_tstamp) verto_get_interval(ev)) / 1000.0; - setuptype(timer, ev, libev_callback, interval, interval); + setuptype(timer, libev_callback, interval, interval); case VERTO_EV_TYPE_IDLE: - setuptype(idle, ev, libev_callback); + setuptype(idle, libev_callback); case VERTO_EV_TYPE_SIGNAL: - setuptype(signal, ev, libev_callback, verto_get_signal(ev)); + setuptype(signal, libev_callback, verto_get_signal(ev)); case VERTO_EV_TYPE_CHILD: *flags &= ~VERTO_EV_FLAG_PERSIST; /* Child events don't persist */ - setuptype(child, ev, libev_callback, verto_get_proc(ev), 0); + setuptype(child, libev_callback, verto_get_proc(ev), 0); default: - return NULL; /* Not supported */ + break; /* Not supported */ } + + if (w.watcher) + w.watcher->data = (void*) ev; + return w.watcher; }
static void -libev_ctx_del(void *ctx, const verto_ev *ev, void *evpriv) +libev_ctx_del(verto_mod_ctx *ctx, const verto_ev *ev, verto_mod_ev *evpriv) { switch (verto_get_type(ev)) { case VERTO_EV_TYPE_IO: - ev_io_stop(ctx, evpriv); + ev_io_stop(ctx, (ev_io*) evpriv); break; case VERTO_EV_TYPE_TIMEOUT: - ev_timer_stop(ctx, evpriv); + ev_timer_stop(ctx, (ev_timer*) evpriv); break; case VERTO_EV_TYPE_IDLE: - ev_idle_stop(ctx, evpriv); + ev_idle_stop(ctx, (ev_idle*) evpriv); break; case VERTO_EV_TYPE_SIGNAL: - ev_signal_stop(ctx, evpriv); + ev_signal_stop(ctx, (ev_signal*) evpriv); break; case VERTO_EV_TYPE_CHILD: - ev_child_stop(ctx, evpriv); + ev_child_stop(ctx, (ev_child*) evpriv); break; default: break; diff --git a/src/verto-libevent.c b/src/verto-libevent.c index 6619c31..5045b14 100644 --- a/src/verto-libevent.c +++ b/src/verto-libevent.c @@ -27,6 +27,9 @@ #include <errno.h>
#include <verto-libevent.h> +#define VERTO_MODULE_TYPES +typedef struct event_base verto_mod_ctx; +typedef struct event verto_mod_ev; #include <verto-module.h>
#include <event2/event_compat.h> @@ -37,34 +40,34 @@ extern struct event_base *event_global_current_base_;
static void -libevent_ctx_free(void *priv) +libevent_ctx_free(verto_mod_ctx *ctx) { - if (priv != event_global_current_base_) - event_base_free(priv); + if (ctx != event_global_current_base_) + event_base_free(ctx); }
static void -libevent_ctx_run(void *priv) +libevent_ctx_run(verto_mod_ctx *ctx) { - event_base_dispatch(priv); + event_base_dispatch(ctx); }
static void -libevent_ctx_run_once(void *priv) +libevent_ctx_run_once(verto_mod_ctx *ctx) { - event_base_loop(priv, EVLOOP_ONCE); + event_base_loop(ctx, EVLOOP_ONCE); }
static void -libevent_ctx_break(void *priv) +libevent_ctx_break(verto_mod_ctx *ctx) { - event_base_loopbreak(priv); + event_base_loopbreak(ctx); }
static void -libevent_ctx_reinitialize(void *priv) +libevent_ctx_reinitialize(verto_mod_ctx *ctx) { - event_reinit(priv); + event_reinit(ctx); }
static void @@ -73,8 +76,8 @@ libevent_callback(evutil_socket_t socket, short type, void *data) verto_fire(data); }
-static void * -libevent_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags) +static verto_mod_ev * +libevent_ctx_add(verto_mod_ctx *ctx, const verto_ev *ev, verto_ev_flag *flags) { struct event *priv = NULL; struct timeval *timeout = NULL; @@ -126,7 +129,7 @@ libevent_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags) }
static void -libevent_ctx_del(void *ctx, const verto_ev *ev, void *evpriv) +libevent_ctx_del(verto_mod_ctx *ctx, const verto_ev *ev, verto_mod_ev *evpriv) { event_del(evpriv); event_free(evpriv); diff --git a/src/verto-module.h b/src/verto-module.h index 243fb6b..b1105b0 100644 --- a/src/verto-module.h +++ b/src/verto-module.h @@ -29,6 +29,12 @@
#include <verto.h>
+#ifndef VERTO_MODULE_TYPES +#define VERTO_MODULE_TYPES +typedef void verto_mod_ctx; +typedef void verto_mod_ev; +#endif + #define VERTO_MODULE_VERSION 1 #define VERTO_MODULE_TABLE(name) verto_module_table_ ## name #define VERTO_MODULE(name, symb, types) \ @@ -62,13 +68,15 @@ typedef struct { } verto_module;
typedef struct { - void (*ctx_free)(void *ctx); - void (*ctx_run)(void *ctx); - void (*ctx_run_once)(void *ctx); - void (*ctx_break)(void *ctx); - void (*ctx_reinitialize)(void *ctx); - void *(*ctx_add)(void *ctx, const verto_ev *ev, verto_ev_flag *flags); - void (*ctx_del)(void *ctx, const verto_ev *ev, void *evpriv); + void (*ctx_free)(verto_mod_ctx *ctx); + void (*ctx_run)(verto_mod_ctx *ctx); + void (*ctx_run_once)(verto_mod_ctx *ctx); + void (*ctx_break)(verto_mod_ctx *ctx); + void (*ctx_reinitialize)(verto_mod_ctx *ctx); + verto_mod_ev *(*ctx_add)(verto_mod_ctx *ctx, const verto_ev *ev, + verto_ev_flag *flags); + void (*ctx_del)(verto_mod_ctx *ctx, const verto_ev *ev, + verto_mod_ev *modev); } verto_ctx_funcs;
/** @@ -103,7 +111,7 @@ typedef struct { verto_ctx * verto_convert_funcs(const verto_ctx_funcs *funcs, const verto_module *module, - void *priv); + verto_mod_ctx *priv);
/** * Calls the callback of the verto_ev and then frees it via verto_del(). diff --git a/src/verto-tevent.c b/src/verto-tevent.c index b18e71a..a9ec998 100644 --- a/src/verto-tevent.c +++ b/src/verto-tevent.c @@ -27,10 +27,14 @@ #include <errno.h>
#include <verto-tevent.h> -#include <verto-module.h>
-#define tctx(p) ((tevent_ev_ctx *) p)->ctx -#define texit(p) ((tevent_ev_ctx *) p)->exit +#define VERTO_MODULE_TYPES +typedef struct { + struct tevent_context *ctx; + char exit; +} verto_mod_ctx; +typedef void verto_mod_ev; +#include <verto-module.h>
#ifndef TEVENT_FD_ERROR #define TEVENT_FD_ERROR 0 @@ -38,42 +42,37 @@
static struct tevent_context *defctx;
-typedef struct { - struct tevent_context *ctx; - char exit; -} tevent_ev_ctx; - static void -tevent_ctx_free(void *priv) +tevent_ctx_free(verto_mod_ctx *ctx) { - if (priv != defctx) - talloc_free(priv); + if (ctx->ctx != defctx) + talloc_free(ctx); }
static void -tevent_ctx_run(void *priv) +tevent_ctx_run(verto_mod_ctx *ctx) { - while (!texit(priv)) - tevent_loop_once(tctx(priv)); - texit(priv) = 0; + while (!ctx->exit) + tevent_loop_once(ctx->ctx); + ctx->exit = 0; }
static void -tevent_ctx_run_once(void *priv) +tevent_ctx_run_once(verto_mod_ctx *ctx) { - tevent_loop_once(priv); + tevent_loop_once(ctx->ctx); }
static void -tevent_ctx_break(void *priv) +tevent_ctx_break(verto_mod_ctx *ctx) { - texit(priv) = 1; + ctx->exit = 1; }
static void -tevent_ctx_reinitialize(void *priv) +tevent_ctx_reinitialize(verto_mod_ctx *ctx) { - tevent_re_initialise(priv); + tevent_re_initialise(ctx->ctx); }
#define definecb(type, ...) \ @@ -87,8 +86,8 @@ definecb(fd, uint16_t fl) definecb(timer, struct timeval ct) definecb(signal, int signum, int count, void *siginfo)
-static void * -tevent_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags) +static verto_mod_ev * +tevent_ctx_add(verto_mod_ctx *ctx, const verto_ev *ev, verto_ev_flag *flags)
{ time_t interval; @@ -102,16 +101,16 @@ tevent_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags) teventflags |= TEVENT_FD_READ; if (verto_get_flags(ev) & VERTO_EV_FLAG_IO_WRITE) teventflags |= TEVENT_FD_WRITE; - return tevent_add_fd(tctx(ctx), tctx(ctx), verto_get_fd(ev), + return tevent_add_fd(ctx->ctx, ctx->ctx, verto_get_fd(ev), teventflags, tevent_fd_cb, (void *) ev); case VERTO_EV_TYPE_TIMEOUT: *flags &= ~VERTO_EV_FLAG_PERSIST; /* Timeout events don't persist */ interval = verto_get_interval(ev); tv = tevent_timeval_current_ofs(interval / 1000, interval % 1000 * 1000); - return tevent_add_timer(tctx(ctx), tctx(ctx), tv, + return tevent_add_timer(ctx->ctx, ctx->ctx, tv, tevent_timer_cb, (void *) ev); case VERTO_EV_TYPE_SIGNAL: - return tevent_add_signal(tctx(ctx), tctx(ctx), verto_get_signal(ev), + return tevent_add_signal(ctx->ctx, ctx->ctx, verto_get_signal(ev), 0, tevent_signal_cb, (void *) ev); case VERTO_EV_TYPE_IDLE: case VERTO_EV_TYPE_CHILD: @@ -121,7 +120,7 @@ tevent_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags) }
static void -tevent_ctx_del(void *priv, const verto_ev *ev, void *evpriv) +tevent_ctx_del(verto_mod_ctx *priv, const verto_ev *ev, verto_mod_ev *evpriv) { talloc_free(evpriv); } @@ -148,9 +147,9 @@ verto_default_tevent(void) verto_ctx * verto_convert_tevent(struct tevent_context *context) { - tevent_ev_ctx *ctx; + verto_mod_ctx *ctx;
- ctx = talloc_zero(NULL, tevent_ev_ctx); + ctx = talloc_zero(NULL, verto_mod_ctx); if (ctx) { talloc_set_name_const(ctx, "libverto"); ctx->ctx = context; diff --git a/src/verto.c b/src/verto.c index 36a95ff..689a62c 100644 --- a/src/verto.c +++ b/src/verto.c @@ -149,7 +149,7 @@ pdladdrmodname(void *addr, char **buf) {
struct _verto_ctx { void *dll; - void *modpriv; + verto_mod_ctx *ctx; verto_ev_type types; verto_ctx_funcs funcs; verto_ev *events; @@ -167,7 +167,7 @@ struct _verto_ev { verto_callback *callback; verto_callback *onfree; void *priv; - void *modpriv; + verto_mod_ev *ev; verto_ev_flag flags; verto_ev_flag actual; size_t depth; @@ -554,7 +554,7 @@ verto_free(verto_ctx *ctx) verto_del(ctx->events);
/* Free the private */ - ctx->funcs.ctx_free(ctx->modpriv); + ctx->funcs.ctx_free(ctx->ctx);
/* Unload the module */ if (ctx->dll) { @@ -596,7 +596,7 @@ verto_run(verto_ctx *ctx) { if (!ctx) return; - ctx->funcs.ctx_run(ctx->modpriv); + ctx->funcs.ctx_run(ctx->ctx); }
void @@ -604,7 +604,7 @@ verto_run_once(verto_ctx *ctx) { if (!ctx) return; - ctx->funcs.ctx_run_once(ctx->modpriv); + ctx->funcs.ctx_run_once(ctx->ctx); }
void @@ -612,7 +612,7 @@ verto_break(verto_ctx *ctx) { if (!ctx) return; - ctx->funcs.ctx_break(ctx->modpriv); + ctx->funcs.ctx_break(ctx->ctx); }
void @@ -627,19 +627,19 @@ verto_reinitialize(verto_ctx *ctx) next = tmp->next;
if (tmp->flags & VERTO_EV_FLAG_REINITIABLE) - ctx->funcs.ctx_del(ctx->modpriv, tmp, tmp->modpriv); + ctx->funcs.ctx_del(ctx->ctx, tmp, tmp->ev); else verto_del(tmp); }
/* Reinit the loop */ - ctx->funcs.ctx_reinitialize(ctx->modpriv); + ctx->funcs.ctx_reinitialize(ctx->ctx);
/* Recreate events that were marked forkable */ for (tmp = ctx->events; tmp; tmp = tmp->next) { tmp->actual = tmp->flags; - tmp->modpriv = ctx->funcs.ctx_add(ctx->modpriv, tmp, &tmp->actual); - assert(tmp->modpriv); + tmp->ev = ctx->funcs.ctx_add(ctx->ctx, tmp, &tmp->actual); + assert(tmp->ev); } }
@@ -648,14 +648,13 @@ verto_reinitialize(verto_ctx *ctx) if (ev) { \ set; \ ev->actual = ev->flags; \ - ev->modpriv = ctx->funcs.ctx_add(ctx->modpriv, ev, &ev->actual); \ - if (!ev->modpriv) { \ + ev->ev = ctx->funcs.ctx_add(ctx->ctx, ev, &ev->actual); \ + if (!ev->ev) { \ free(ev); \ return NULL; \ } \ push_ev(ctx, ev); \ - } \ - return ev; + }
verto_ev * verto_add_io(verto_ctx *ctx, verto_ev_flag flags, @@ -667,6 +666,7 @@ verto_add_io(verto_ctx *ctx, verto_ev_flag flags, return NULL;
doadd(ev, ev->option.fd = fd, VERTO_EV_TYPE_IO); + return ev; }
verto_ev * @@ -675,6 +675,7 @@ verto_add_timeout(verto_ctx *ctx, verto_ev_flag flags, { verto_ev *ev; doadd(ev, ev->option.interval = interval, VERTO_EV_TYPE_TIMEOUT); + return ev; }
verto_ev * @@ -683,6 +684,7 @@ verto_add_idle(verto_ctx *ctx, verto_ev_flag flags, { verto_ev *ev; doadd(ev,, VERTO_EV_TYPE_IDLE); + return ev; }
verto_ev * @@ -703,6 +705,7 @@ verto_add_signal(verto_ctx *ctx, verto_ev_flag flags, return NULL; } doadd(ev, ev->option.signal = signal, VERTO_EV_TYPE_SIGNAL); + return ev; }
verto_ev * @@ -720,6 +723,7 @@ verto_add_child(verto_ctx *ctx, verto_ev_flag flags, #endif return NULL; doadd(ev, ev->option.child.proc = proc, VERTO_EV_TYPE_CHILD); + return ev; }
void @@ -805,7 +809,7 @@ verto_del(verto_ev *ev)
if (ev->onfree) ev->onfree(ev->ctx, ev); - ev->ctx->funcs.ctx_del(ev->ctx->modpriv, ev, ev->modpriv); + ev->ctx->funcs.ctx_del(ev->ctx->ctx, ev, ev->ev); remove_ev(&(ev->ctx->events), ev); free(ev); } @@ -832,7 +836,7 @@ verto_convert_funcs(const verto_ctx_funcs *funcs, if (!ctx) return NULL;
- ctx->modpriv = ctx_private; + ctx->ctx = ctx_private; ctx->funcs = *funcs; ctx->types = module->types;
@@ -856,10 +860,10 @@ verto_fire(verto_ev *ev) verto_del(ev); else if (!ev->actual & VERTO_EV_FLAG_PERSIST) { ev->actual = ev->flags; - priv = ev->ctx->funcs.ctx_add(ev->ctx->modpriv, ev, &ev->actual); + priv = ev->ctx->funcs.ctx_add(ev->ctx->ctx, ev, &ev->actual); assert(priv); /* TODO: create an error callback */ - ev->ctx->funcs.ctx_del(ev->ctx->modpriv, ev, ev->modpriv); - ev->modpriv = priv; + ev->ctx->funcs.ctx_del(ev->ctx->ctx, ev, ev->ev); + ev->ev = priv; } } }
libverto-commits@lists.fedorahosted.org