summaryrefslogtreecommitdiffstats
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-05-06 14:52:17 +0200
committerVolker Lendecke <vl@samba.org>2009-05-07 22:52:33 +0200
commit6f320d0208be9e460af1bd10c0e42e78e17d53dc (patch)
tree7e469947821ec99ffb5c80638898abd6072fd341 /source3/lib
parent2d5e0eadb858d9717b68a770c8789a9432bbb3f7 (diff)
downloadsamba-6f320d0208be9e460af1bd10c0e42e78e17d53dc.tar.gz
samba-6f320d0208be9e460af1bd10c0e42e78e17d53dc.tar.xz
samba-6f320d0208be9e460af1bd10c0e42e78e17d53dc.zip
Adapt wb_reqtrans to "recent" coding conventions
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/wb_reqtrans.c72
1 files changed, 28 insertions, 44 deletions
diff --git a/source3/lib/wb_reqtrans.c b/source3/lib/wb_reqtrans.c
index dbea8b6686d..b64efecef34 100644
--- a/source3/lib/wb_reqtrans.c
+++ b/source3/lib/wb_reqtrans.c
@@ -88,25 +88,21 @@ struct tevent_req *wb_req_read_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
int fd, size_t max_extra_data)
{
- struct tevent_req *result, *subreq;
+ struct tevent_req *req, *subreq;
struct req_read_state *state;
- result = tevent_req_create(mem_ctx, &state, struct req_read_state);
- if (result == NULL) {
+ req = tevent_req_create(mem_ctx, &state, struct req_read_state);
+ if (req == NULL) {
return NULL;
}
state->max_extra_data = max_extra_data;
subreq = read_packet_send(state, ev, fd, 4, wb_req_more, state);
- if (subreq == NULL) {
- goto nomem;
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
}
-
- tevent_req_set_callback(subreq, wb_req_read_done, result);
- return result;
- nomem:
- TALLOC_FREE(result);
- return NULL;
+ tevent_req_set_callback(subreq, wb_req_read_done, req);
+ return req;
}
static ssize_t wb_req_more(uint8_t *buf, size_t buflen, void *private_data)
@@ -189,12 +185,12 @@ struct tevent_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
struct tevent_queue *queue, int fd,
struct winbindd_request *wb_req)
{
- struct tevent_req *result, *subreq;
+ struct tevent_req *req, *subreq;
struct req_write_state *state;
int count = 1;
- result = tevent_req_create(mem_ctx, &state, struct req_write_state);
- if (result == NULL) {
+ req = tevent_req_create(mem_ctx, &state, struct req_write_state);
+ if (req == NULL) {
return NULL;
}
@@ -208,15 +204,11 @@ struct tevent_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
}
subreq = writev_send(state, ev, queue, fd, state->iov, count);
- if (subreq == NULL) {
- goto fail;
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
}
- tevent_req_set_callback(subreq, wb_req_write_done, result);
- return result;
-
- fail:
- TALLOC_FREE(result);
- return NULL;
+ tevent_req_set_callback(subreq, wb_req_write_done, req);
+ return req;
}
static void wb_req_write_done(struct tevent_req *subreq)
@@ -250,24 +242,20 @@ static void wb_resp_read_done(struct tevent_req *subreq);
struct tevent_req *wb_resp_read_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev, int fd)
{
- struct tevent_req *result, *subreq;
+ struct tevent_req *req, *subreq;
struct resp_read_state *state;
- result = tevent_req_create(mem_ctx, &state, struct resp_read_state);
- if (result == NULL) {
+ req = tevent_req_create(mem_ctx, &state, struct resp_read_state);
+ if (req == NULL) {
return NULL;
}
subreq = read_packet_send(state, ev, fd, 4, wb_resp_more, state);
- if (subreq == NULL) {
- goto nomem;
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
}
- tevent_req_set_callback(subreq, wb_resp_read_done, result);
- return result;
-
- nomem:
- TALLOC_FREE(result);
- return NULL;
+ tevent_req_set_callback(subreq, wb_resp_read_done, req);
+ return req;
}
static ssize_t wb_resp_more(uint8_t *buf, size_t buflen, void *private_data)
@@ -339,12 +327,12 @@ struct tevent_req *wb_resp_write_send(TALLOC_CTX *mem_ctx,
struct tevent_queue *queue, int fd,
struct winbindd_response *wb_resp)
{
- struct tevent_req *result, *subreq;
+ struct tevent_req *req, *subreq;
struct resp_write_state *state;
int count = 1;
- result = tevent_req_create(mem_ctx, &state, struct resp_write_state);
- if (result == NULL) {
+ req = tevent_req_create(mem_ctx, &state, struct resp_write_state);
+ if (req == NULL) {
return NULL;
}
@@ -359,15 +347,11 @@ struct tevent_req *wb_resp_write_send(TALLOC_CTX *mem_ctx,
}
subreq = writev_send(state, ev, queue, fd, state->iov, count);
- if (subreq == NULL) {
- goto fail;
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
}
- tevent_req_set_callback(subreq, wb_resp_write_done, result);
- return result;
-
- fail:
- TALLOC_FREE(result);
- return NULL;
+ tevent_req_set_callback(subreq, wb_resp_write_done, req);
+ return req;
}
static void wb_resp_write_done(struct tevent_req *subreq)