Alexandre Julliard : ws2_32:
Store the local iosb in the ws2_async structure to avoid a memory
allocation .
Alexandre Julliard
julliard at wine.codeweavers.com
Thu May 31 08:33:37 CDT 2007
Module: wine
Branch: master
Commit: 442bd1b5fc191f4d71335ea81a326a39ca79c7e1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=442bd1b5fc191f4d71335ea81a326a39ca79c7e1
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu May 31 12:07:14 2007 +0200
ws2_32: Store the local iosb in the ws2_async structure to avoid a memory allocation.
---
dlls/ws2_32/socket.c | 21 +++------------------
1 files changed, 3 insertions(+), 18 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 85a2269..d9cc023 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -188,6 +188,7 @@ typedef struct ws2_async
enum ws2_mode {ws2m_read, ws2m_write, ws2m_sd_read, ws2m_sd_write} mode;
LPWSAOVERLAPPED user_overlapped;
LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_func;
+ IO_STATUS_BLOCK local_iosb;
struct iovec *iovec;
int n_iovecs;
struct WS_sockaddr *addr;
@@ -1031,15 +1032,6 @@ static void ws2_async_terminate(ws2_async* as, IO_STATUS_BLOCK* iosb, NTSTATUS s
if (as->completion_func)
as->completion_func( NtStatusToWSAError(status),
count, as->user_overlapped, as->flags );
- if ( !as->user_overlapped )
- {
-#if 0
- /* FIXME: I don't think this is really used */
- if ( as->overlapped->hEvent != INVALID_HANDLE_VALUE )
- WSACloseEvent( as->overlapped->hEvent );
-#endif
- HeapFree( GetProcessHeap(), 0, iosb );
- }
HeapFree( GetProcessHeap(), 0, as->iovec );
HeapFree( GetProcessHeap(), 0, as );
@@ -1097,19 +1089,14 @@ WS2_make_async(SOCKET s, enum ws2_mode mode, struct iovec *iovec, DWORD dwBuffer
if (!lpCompletionRoutine)
wsa->event = lpOverlapped->hEvent;
}
- else if (!(*piosb = HeapAlloc( GetProcessHeap(), 0, sizeof(IO_STATUS_BLOCK))))
- goto error;
+ else
+ *piosb = &wsa->local_iosb;
TRACE( "wsa %p, h %p, ev %p, iosb %p, uov %p, cfunc %p\n",
wsa, wsa->hSocket, wsa->event,
*piosb, wsa->user_overlapped, wsa->completion_func );
return wsa;
-
-error:
- TRACE("Error\n");
- HeapFree( GetProcessHeap(), 0, wsa );
- return NULL;
}
static ULONG ws2_queue_async(struct ws2_async* wsa, IO_STATUS_BLOCK* iosb)
@@ -2759,8 +2746,6 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
{
err = NtStatusToWSAError( ret );
- if ( !lpOverlapped )
- HeapFree( GetProcessHeap(), 0, iosb );
HeapFree( GetProcessHeap(), 0, wsa );
goto err_free;
}
More information about the wine-cvs
mailing list