summaryrefslogtreecommitdiff
path: root/source3/lib/wb_reqtrans.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-01-18 16:38:30 +0100
committerVolker Lendecke <vl@samba.org>2009-01-18 16:45:07 +0100
commit0dbd3968626445b4dcb00307e45206b37dd0e8ad (patch)
tree79ffe7396e8af5c52593509df3877c545970d2b3 /source3/lib/wb_reqtrans.c
parentc45b6ec29a5b3a39b83209e970b645e5ed0a411c (diff)
downloadsamba-0dbd3968626445b4dcb00307e45206b37dd0e8ad.tar.gz
samba-0dbd3968626445b4dcb00307e45206b37dd0e8ad.tar.bz2
samba-0dbd3968626445b4dcb00307e45206b37dd0e8ad.zip
Add a macro async_req_setup()
This streamlines setting up a multi-step async request a bit
Diffstat (limited to 'source3/lib/wb_reqtrans.c')
-rw-r--r--source3/lib/wb_reqtrans.c44
1 files changed, 8 insertions, 36 deletions
diff --git a/source3/lib/wb_reqtrans.c b/source3/lib/wb_reqtrans.c
index 1f5f181aa1..0e6e5d15c4 100644
--- a/source3/lib/wb_reqtrans.c
+++ b/source3/lib/wb_reqtrans.c
@@ -43,17 +43,10 @@ struct async_req *wb_req_read_send(TALLOC_CTX *mem_ctx,
struct async_req *result, *subreq;
struct req_read_state *state;
- result = async_req_new(mem_ctx);
- if (result == NULL) {
+ if (!async_req_setup(mem_ctx, &result, &state,
+ struct req_read_state)) {
return NULL;
}
-
- state = talloc(result, struct req_read_state);
- if (state == NULL) {
- goto nomem;
- }
- result->private_data = state;
-
state->fd = fd;
state->ev = ev;
state->max_extra_data = max_extra_data;
@@ -205,17 +198,10 @@ struct async_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
struct async_req *result, *subreq;
struct req_write_state *state;
- result = async_req_new(mem_ctx);
- if (result == NULL) {
+ if (!async_req_setup(mem_ctx, &result, &state,
+ struct req_write_state)) {
return NULL;
}
-
- state = talloc(result, struct req_write_state);
- if (state == NULL) {
- goto nomem;
- }
- result->private_data = state;
-
state->fd = fd;
state->ev = ev;
state->wb_req = wb_req;
@@ -304,17 +290,10 @@ struct async_req *wb_resp_read_send(TALLOC_CTX *mem_ctx,
struct async_req *result, *subreq;
struct resp_read_state *state;
- result = async_req_new(mem_ctx);
- if (result == NULL) {
+ if (!async_req_setup(mem_ctx, &result, &state,
+ struct resp_read_state)) {
return NULL;
}
-
- state = talloc(result, struct resp_read_state);
- if (state == NULL) {
- goto nomem;
- }
- result->private_data = state;
-
state->fd = fd;
state->ev = ev;
state->wb_resp = talloc(state, struct winbindd_response);
@@ -458,17 +437,10 @@ struct async_req *wb_resp_write_send(TALLOC_CTX *mem_ctx,
struct async_req *result, *subreq;
struct resp_write_state *state;
- result = async_req_new(mem_ctx);
- if (result == NULL) {
+ if (!async_req_setup(mem_ctx, &result, &state,
+ struct resp_write_state)) {
return NULL;
}
-
- state = talloc(result, struct resp_write_state);
- if (state == NULL) {
- goto nomem;
- }
- result->private_data = state;
-
state->fd = fd;
state->ev = ev;
state->wb_resp = wb_resp;