diff options
author | jan.nijtmans <jan.nijtmans@noemail.net> | 2012-08-20 09:12:39 (GMT) |
---|---|---|
committer | jan.nijtmans <jan.nijtmans@noemail.net> | 2012-08-20 09:12:39 (GMT) |
commit | 9d82e1e8d422b0281a853838329db1ed1ef4ef0b (patch) | |
tree | ad4f6154d11316178dc93d74e7733cbb09886a7f | |
parent | 93b534b6c4ea70218666ad1b5f624c6f8a81e6c2 (diff) | |
parent | 72d2bce23769b52bd6c913cc654a59ca1c295e3b (diff) | |
download | tcl-9d82e1e8d422b0281a853838329db1ed1ef4ef0b.zip tcl-9d82e1e8d422b0281a853838329db1ed1ef4ef0b.tar.gz tcl-9d82e1e8d422b0281a853838329db1ed1ef4ef0b.tar.bz2 |
Remove wrapper macro for ntohs(): unnecessary, because it doesn't require an initialized winsock_2 library
FossilOrigin-Name: 46096ee96acbd2f2d5c9bd742c4e7c8e25871334
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | generic/tclStubInit.c | 8 | ||||
-rw-r--r-- | win/tclWinPort.h | 1 | ||||
-rw-r--r-- | win/tclWinSock.c | 22 |
4 files changed, 12 insertions, 27 deletions
@@ -1,3 +1,11 @@ +2012-08-20 Jan Nijtmans <nijtmans@users.sf.net> + + * win/tclWinPort.h: Remove wrapper macro for ntohs(): unnecessary, + because it doesn't require an initialized winsock_2 library. See: + <http://msdn.microsoft.com/en-us/library/windows/desktop/ms740075%28v=vs.85%29.aspx> + * win/tclWinSock.c + * generic/tclStubInit.c + 2012-08-17 Jan Nijtmans <nijtmans@users.sf.net> * win/nmakehlp.c: Add "-V<num>" option, in order to be able diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 87cd4eb..7eb1788 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -53,6 +53,8 @@ static int TclSockMinimumBuffersOld(int sock, int size) } #endif +#define TclWinNToHS ntohs + #ifdef __WIN32__ # define TclUnixWaitForFile 0 # define TclUnixCopyFile 0 @@ -89,12 +91,6 @@ void *TclWinGetTclInstance() return hInstance; } -unsigned short -TclWinNToHS(unsigned short ns) -{ - return ntohs(ns); -} - int TclWinSetSockOpt(SOCKET s, int level, int optname, const char *optval, int optlen) diff --git a/win/tclWinPort.h b/win/tclWinPort.h index c6ac2b7..48f7894 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -538,7 +538,6 @@ typedef DWORD_PTR * PDWORD_PTR; #define getservbyname TclWinGetServByName #define getsockopt TclWinGetSockOpt -#define ntohs TclWinNToHS #define setsockopt TclWinSetSockOpt /* This type is not defined in the Windows headers */ #define socklen_t int diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 9f7caee..1a74354 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -72,7 +72,6 @@ #undef getservbyname #undef getsockopt -#undef ntohs #undef setsockopt /* @@ -163,7 +162,7 @@ struct SocketInfo { * socket event occurs. */ -typedef struct SocketEvent { +typedef struct { Tcl_Event header; /* Information that is standard for all * events. */ SOCKET socket; /* Socket descriptor that is ready. Used to @@ -191,7 +190,7 @@ typedef struct SocketEvent { #define SOCKET_PENDING (1<<3) /* A message has been sent for this * socket */ -typedef struct ThreadSpecificData { +typedef struct { HWND hwnd; /* Handle to window for socket messages. */ HANDLE socketThread; /* Thread handling the window */ Tcl_ThreadId threadId; /* Parent thread. */ @@ -2736,23 +2735,6 @@ TclWinSetSockOpt( return setsockopt(s, level, optname, optval, optlen); } -unsigned short -TclWinNToHS( - unsigned short netshort) -{ - /* - * Check that WinSock is initialized; do not call it if not, to prevent - * system crashes. This can happen at exit time if the exit handler for - * WinSock ran before other exit handlers that want to use sockets. - */ - - if (!SocketsEnabled()) { - return (unsigned short) -1; - } - - return ntohs(netshort); -} - char * TclpInetNtoa( struct in_addr addr) |