summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2018-10-01 15:55:23 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2018-10-01 15:55:23 +0200
commit961671c0f51693aff34bf3adf5319b35275a86d3 (patch)
tree1eae258f41d0dc67abdc45da6bc16f253a4f23dc /proto
parent0db7a1d69c80b1089f10a268ceacb059db41ced8 (diff)
Lib: Add and use ev_new_init()
Diffstat (limited to 'proto')
-rw-r--r--proto/babel/babel.c4
-rw-r--r--proto/bgp/bgp.c9
-rw-r--r--proto/ospf/ospf.c4
-rw-r--r--proto/static/static.c4
4 files changed, 5 insertions, 16 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
index afa482bb..12c9a474 100644
--- a/proto/babel/babel.c
+++ b/proto/babel/babel.c
@@ -1592,9 +1592,7 @@ babel_add_iface(struct babel_proto *p, struct iface *new, struct babel_iface_con
ifa->timer = tm_new_init(ifa->pool, babel_iface_timer, ifa, 0, 0);
init_list(&ifa->msg_queue);
- ifa->send_event = ev_new(ifa->pool);
- ifa->send_event->hook = babel_send_queue;
- ifa->send_event->data = ifa;
+ ifa->send_event = ev_new_init(ifa->pool, babel_send_queue, ifa);
struct object_lock *lock = olock_new(ifa->pool);
lock->type = OBJLOCK_UDP;
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index d2abcc5b..e7479df7 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -977,9 +977,7 @@ bgp_setup_conn(struct bgp_proto *p, struct bgp_conn *conn)
conn->hold_timer = tm_new_init(p->p.pool, bgp_hold_timeout, conn, 0, 0);
conn->keepalive_timer = tm_new_init(p->p.pool, bgp_keepalive_timeout, conn, 0, 0);
- conn->tx_ev = ev_new(p->p.pool);
- conn->tx_ev->hook = bgp_kick_tx;
- conn->tx_ev->data = conn;
+ conn->tx_ev = ev_new_init(p->p.pool, bgp_kick_tx, conn);
}
static void
@@ -1402,10 +1400,7 @@ bgp_start(struct proto *P)
p->gr_ready = 0;
p->gr_active_num = 0;
- p->event = ev_new(p->p.pool);
- p->event->hook = bgp_decision;
- p->event->data = p;
-
+ p->event = ev_new_init(p->p.pool, bgp_decision, p);
p->startup_timer = tm_new_init(p->p.pool, bgp_startup_timeout, p, 0, 0);
p->gr_timer = tm_new_init(p->p.pool, bgp_graceful_restart_timeout, p, 0, 0);
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index 327ad0a4..4faad360 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -256,9 +256,7 @@ ospf_start(struct proto *P)
p->gr = ospf_top_new(p, P->pool);
s_init_list(&(p->lsal));
- p->flood_event = ev_new(P->pool);
- p->flood_event->hook = ospf_flood_event;
- p->flood_event->data = p;
+ p->flood_event = ev_new_init(P->pool, ospf_flood_event, p);
p->log_pkt_tbf = (struct tbf){ .rate = 1, .burst = 5 };
p->log_lsa_tbf = (struct tbf){ .rate = 4, .burst = 20 };
diff --git a/proto/static/static.c b/proto/static/static.c
index 40096c16..75a74ad0 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -420,9 +420,7 @@ static_start(struct proto *P)
if (p->igp_table_ip6)
rt_lock_table(p->igp_table_ip6);
- p->event = ev_new(p->p.pool);
- p->event->hook = static_announce_marked;
- p->event->data = p;
+ p->event = ev_new_init(p->p.pool, static_announce_marked, p);
BUFFER_INIT(p->marked, p->p.pool, 4);