This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix creation of libperl519s.a on Win32 with MinGW
[perl5.git] / win32 / win32sck.c
index a3160de..3773f40 100644 (file)
@@ -63,7 +63,6 @@ EndSockets(void)
 void
 start_sockets(void) 
 {
-    dTHX;
     unsigned short version;
     WSADATA retdata;
     int ret;
@@ -82,15 +81,13 @@ start_sockets(void)
     wsock_started = 1;
 }
 
-/* in no sockets Win32 builds, this fowards to replacements in util.c, dTHX
- * is required
+/* in no sockets Win32 builds, these use the inline functions defined in
+ * perl.h
  */
 u_long
 win32_htonl(u_long hostlong)
 {
-#ifdef MYSWAP
-    dTHX;
-#else
+#ifndef WIN32_NO_SOCKETS
     StartSockets();
 #endif
     return htonl(hostlong);
@@ -99,9 +96,7 @@ win32_htonl(u_long hostlong)
 u_short
 win32_htons(u_short hostshort)
 {
-#ifdef MYSWAP
-    dTHX;
-#else
+#ifndef WIN32_NO_SOCKETS
     StartSockets();
 #endif
     return htons(hostshort);
@@ -110,9 +105,7 @@ win32_htons(u_short hostshort)
 u_long
 win32_ntohl(u_long netlong)
 {
-#ifdef MYSWAP
-    dTHX;
-#else
+#ifndef WIN32_NO_SOCKETS
     StartSockets();
 #endif
     return ntohl(netlong);
@@ -121,9 +114,7 @@ win32_ntohl(u_long netlong)
 u_short
 win32_ntohs(u_short netshort)
 {
-#ifdef MYSWAP
-    dTHX;
-#else
+#ifndef WIN32_NO_SOCKETS
     StartSockets();
 #endif
     return ntohs(netshort);
@@ -525,11 +516,12 @@ win32_getprotobynumber(int num)
 struct servent *
 win32_getservbyname(const char *name, const char *proto)
 {
-    dTHX;    
+    dTHXa(NULL);    
     struct servent *r;
 
     SOCKET_TEST(r = getservbyname(name, proto), NULL);
     if (r) {
+        aTHXa(PERL_GET_THX);
        r = win32_savecopyservent(&w32_servent, r, proto);
     }
     return r;
@@ -538,11 +530,12 @@ win32_getservbyname(const char *name, const char *proto)
 struct servent *
 win32_getservbyport(int port, const char *proto)
 {
-    dTHX; 
+    dTHXa(NULL)
     struct servent *r;
 
     SOCKET_TEST(r = getservbyport(port, proto), NULL);
     if (r) {
+        aTHXa(PERL_GET_THX);
        r = win32_savecopyservent(&w32_servent, r, proto);
     }
     return r;