diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2006-03-30 06:32:37 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2006-03-30 06:32:37 +0000 |
commit | fcff593da564d69c00a6a0bf92b97c16f4311ce1 (patch) | |
tree | 134f6ee2805e71107ed05e36a3706f5d9ed7b02f /lib/libevent/poll.c | |
parent | b7aa5de49394fb2cccba24b4beb9a06d28c8058a (diff) |
introduce a way to free the base.
From libevent CVS
Diffstat (limited to 'lib/libevent/poll.c')
-rw-r--r-- | lib/libevent/poll.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/libevent/poll.c b/lib/libevent/poll.c index fbc5aca4eff..2e76dfc6613 100644 --- a/lib/libevent/poll.c +++ b/lib/libevent/poll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: poll.c,v 1.11 2005/12/02 04:41:30 deraadt Exp $ */ +/* $OpenBSD: poll.c,v 1.12 2006/03/30 06:32:36 brad Exp $ */ /* * Copyright 2000-2003 Niels Provos <provos@citi.umich.edu> @@ -74,6 +74,7 @@ int poll_add (void *, struct event *); int poll_del (void *, struct event *); int poll_recalc (struct event_base *, void *, int); int poll_dispatch (struct event_base *, void *, struct timeval *); +void poll_dealloc (void *); const struct eventop pollops = { "poll", @@ -81,7 +82,8 @@ const struct eventop pollops = { poll_add, poll_del, poll_recalc, - poll_dispatch + poll_dispatch, + poll_dealloc }; void * @@ -356,3 +358,21 @@ poll_del(void *arg, struct event *ev) poll_check_ok(pop); return (0); } + +void +poll_dealloc(void *arg) +{ + struct pollop *pop = arg; + + if (pop->event_set) + free(pop->event_set); + if (pop->event_r_back) + free(pop->event_r_back); + if (pop->event_w_back) + free(pop->event_w_back); + if (pop->idxplus1_by_fd) + free(pop->idxplus1_by_fd); + + memset(pop, 0, sizeof(struct pollop)); + free(pop); +} |