summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-02-28 17:04:00 +0100
committerJeremy Allison <jra@samba.org>2013-03-01 11:59:39 -0800
commitef8130fdbf50384dca3669ab27de4863490d5cb1 (patch)
tree8618dcfc693b7d906428cd386a4a3e9d96bebbe5
parentf75fd905f72fff28cc2d8f5fc4e3240b039d3446 (diff)
downloadsamba-ef8130fdbf50384dca3669ab27de4863490d5cb1.tar.gz
samba-ef8130fdbf50384dca3669ab27de4863490d5cb1.tar.bz2
samba-ef8130fdbf50384dca3669ab27de4863490d5cb1.zip
tevent: merge poll_fresh_fde_destructor() into poll_event_fd_destructor()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--lib/tevent/tevent_poll.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/lib/tevent/tevent_poll.c b/lib/tevent/tevent_poll.c
index 6e1c5c39f2..792abefd48 100644
--- a/lib/tevent/tevent_poll.c
+++ b/lib/tevent/tevent_poll.c
@@ -219,25 +219,15 @@ static int poll_event_fd_destructor(struct tevent_fd *fde)
poll_ev = talloc_get_type_abort(
ev->additional_data, struct poll_event_context);
- poll_ev->fdes[del_idx] = NULL;
- poll_ev->deleted = true;
- poll_event_wake_pollthread(poll_ev);
-done:
- return tevent_common_fd_destructor(fde);
-}
-
-static int poll_fresh_fde_destructor(struct tevent_fd *fde)
-{
- struct tevent_context *ev = fde->event_ctx;
- struct poll_event_context *poll_ev;
+ if (del_idx == UINT64_MAX) {
- if (ev == NULL) {
+ DLIST_REMOVE(poll_ev->fresh, fde);
goto done;
}
- poll_ev = talloc_get_type_abort(
- ev->additional_data, struct poll_event_context);
- DLIST_REMOVE(poll_ev->fresh, fde);
+ poll_ev->fdes[del_idx] = NULL;
+ poll_ev->deleted = true;
+ poll_event_wake_pollthread(poll_ev);
done:
return tevent_common_fd_destructor(fde);
}
@@ -270,7 +260,7 @@ _PRIVATE_ void tevent_poll_event_add_fd_internal(struct tevent_context *ev,
fde->additional_flags = UINT64_MAX;
fde->additional_data = NULL;
DLIST_ADD(poll_ev->fresh, fde);
- talloc_set_destructor(fde, poll_fresh_fde_destructor);
+ talloc_set_destructor(fde, poll_event_fd_destructor);
}
/*
@@ -454,8 +444,6 @@ static bool poll_event_setup_fresh(struct tevent_context *ev,
DLIST_REMOVE(poll_ev->fresh, fde);
DLIST_ADD(ev->fd_events, fde);
- talloc_set_destructor(fde, poll_event_fd_destructor);
-
poll_ev->num_fds += 1;
}
return true;