From 0dbd3968626445b4dcb00307e45206b37dd0e8ad Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 18 Jan 2009 16:38:30 +0100 Subject: Add a macro async_req_setup() This streamlines setting up a multi-step async request a bit --- source3/lib/async_sock.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'source3/lib/async_sock.c') diff --git a/source3/lib/async_sock.c b/source3/lib/async_sock.c index bb89a1353a..73ff6f2870 100644 --- a/source3/lib/async_sock.c +++ b/source3/lib/async_sock.c @@ -106,17 +106,10 @@ static struct async_req *async_syscall_new(TALLOC_CTX *mem_ctx, struct async_req *result; struct async_syscall_state *state; - result = async_req_new(mem_ctx); - if (result == NULL) { - return NULL; - } - - state = talloc(result, struct async_syscall_state); - if (state == NULL) { - TALLOC_FREE(result); + if (!async_req_setup(mem_ctx, &result, &state, + struct async_syscall_state)) { return NULL; } - state->syscall_type = type; result->private_data = state; @@ -569,15 +562,10 @@ struct async_req *async_connect_send(TALLOC_CTX *mem_ctx, struct fd_event *fde; NTSTATUS status; - result = async_req_new(mem_ctx); - if (result == NULL) { + if (!async_req_setup(mem_ctx, &result, &state, + struct async_connect_state)) { return NULL; } - state = talloc(result, struct async_connect_state); - if (state == NULL) { - goto fail; - } - result->private_data = state; /** * We have to set the socket to nonblocking for async connect(2). Keep -- cgit