The branch, master has been updated via 825949b810c6e7b7b977283355e658e2edbb8932 (commit) via 09d1b2324cf02c20daa005e6f5d55dc107303af7 (commit) from 97cccb22194380ce84bf6188df90e2438f1176db (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 825949b810c6e7b7b977283355e658e2edbb8932 Author: Stefan Metzmacher <me...@samba.org> Date: Tue Mar 10 14:02:30 2009 +0100 tevent: add tevent_req_callback_data_void() macro Callers can use it instead of tevent_req_callback_data() if they use a non talloc private pointer. metze commit 09d1b2324cf02c20daa005e6f5d55dc107303af7 Author: Stefan Metzmacher <me...@samba.org> Date: Tue Mar 10 13:54:57 2009 +0100 tevent: add tevent_req_received() function This function can be called as last action of a _recv() function, it destroys the data attached to the tevent_req. metze ----------------------------------------------------------------------- Summary of changes: lib/tevent/tevent.h | 10 +++++++++- lib/tevent/tevent_internal.h | 2 +- lib/tevent/tevent_req.c | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h index 5089d18..2dadfc1 100644 --- a/lib/tevent/tevent.h +++ b/lib/tevent/tevent.h @@ -165,7 +165,11 @@ enum tevent_req_state { /** * No memory in between */ - TEVENT_REQ_NO_MEMORY + TEVENT_REQ_NO_MEMORY, + /** + * the request is already received by the caller + */ + TEVENT_REQ_RECEIVED }; /** @@ -193,6 +197,8 @@ void *_tevent_req_data(struct tevent_req *req); #define tevent_req_callback_data(_req, _type) \ talloc_get_type_abort(_tevent_req_callback_data(_req), _type) +#define tevent_req_callback_data_void(_req) \ + _tevent_req_callback_data(_req) #define tevent_req_data(_req, _type) \ talloc_get_type_abort(_tevent_req_data(_req), _type) @@ -238,6 +244,8 @@ bool tevent_req_is_error(struct tevent_req *req, enum tevent_req_state *state, uint64_t *error); +void tevent_req_received(struct tevent_req *req); + struct tevent_req *tevent_wakeup_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct timeval wakeup_time); diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h index fa73b22..5a645ec 100644 --- a/lib/tevent/tevent_internal.h +++ b/lib/tevent/tevent_internal.h @@ -56,7 +56,7 @@ struct tevent_req { /** * @brief A function to overwrite the default print function * - * The implementation doing the work may want to imeplement a + * The implementation doing the work may want to implement a * custom function to print the text representation of the async * request. */ diff --git a/lib/tevent/tevent_req.c b/lib/tevent/tevent_req.c index 9b3e00e..3832088 100644 --- a/lib/tevent/tevent_req.c +++ b/lib/tevent/tevent_req.c @@ -256,6 +256,27 @@ bool tevent_req_is_in_progress(struct tevent_req *req) return false; } +/** + * @brief This function destroys the attached private data + * @param[in] req The finished request + * + * This function can be called as last action of a _recv() + * function, it destroys the data attached to the tevent_req. + */ +void tevent_req_received(struct tevent_req *req) +{ + talloc_free(req->data); + req->data = NULL; + req->private_print = NULL; + + talloc_free(req->internal.trigger); + req->internal.trigger = NULL; + talloc_free(req->internal.timer); + req->internal.timer = NULL; + + req->internal.state = TEVENT_REQ_RECEIVED; +} + bool tevent_req_poll(struct tevent_req *req, struct tevent_context *ev) { -- Samba Shared Repository