ws2_32: Rearrange the code to avoid a needless release_sock_fd().

Dmitry Timoshkov dmitry at codeweavers.com
Tue Aug 3 22:14:52 CDT 2010


---
 dlls/ws2_32/socket.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 22c72f3..f129b08 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -1902,20 +1902,21 @@ int WINAPI WSAConnect( SOCKET s, const struct WS_sockaddr* name, int namelen,
 /***********************************************************************
  *             ConnectEx
  */
-BOOL WINAPI WS2_ConnectEx(SOCKET s, const struct WS_sockaddr* name, int namelen,
+static BOOL WINAPI WS2_ConnectEx(SOCKET s, const struct WS_sockaddr* name, int namelen,
                           PVOID sendBuf, DWORD sendBufLen, LPDWORD sent, LPOVERLAPPED ov)
 {
-    int fd = get_sock_fd( s, FILE_READ_DATA, NULL );
-    int ret, status;
-    if (fd == -1)
+    int fd, ret, status;
+
+    if (!ov)
     {
-        SetLastError( WSAENOTSOCK );
+        SetLastError( ERROR_INVALID_PARAMETER );
         return FALSE;
     }
-    if (!ov)
+
+    fd = get_sock_fd( s, FILE_READ_DATA, NULL );
+    if (fd == -1)
     {
-        release_sock_fd(s, fd);
-        SetLastError( ERROR_INVALID_PARAMETER );
+        SetLastError( WSAENOTSOCK );
         return FALSE;
     }
 
-- 
1.7.0.6




More information about the wine-patches mailing list