From fd729b32a8966291f007567f72f3dc0158bdab35 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Mon, 5 Oct 2015 11:47:51 +0800 Subject: Added support for arbitrary datagram sizes. The maximum size is still constant per UDP object, but the size can be speficied at creation time. --- src/udp.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/udp.h') diff --git a/src/udp.h b/src/udp.h index 2b831a5..da27a7a 100644 --- a/src/udp.h +++ b/src/udp.h @@ -8,7 +8,7 @@ * (AF_INET, SOCK_DGRAM). * * Two classes are defined: connected and unconnected. UDP objects are -* originally unconnected. They can be "connected" to a given address +* originally unconnected. They can be "connected" to a given address * with a call to the setpeername function. The same function can be used to * break the connection. \*=========================================================================*/ @@ -17,13 +17,14 @@ #include "timeout.h" #include "socket.h" -/* can't be larger than wsocket.c MAXCHUNK!!! */ #define UDP_DATAGRAMSIZE 8192 typedef struct t_udp_ { t_socket sock; t_timeout tm; int family; + size_t len; /* length of datagram buffer below */ + char buf[1]; /* allocate larger structure to hold actual buffer */ } t_udp; typedef t_udp *p_udp; -- cgit v1.2.3-55-g6feb From be67f63f4e11e53690bf1431a236f86b484c9bf0 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Tue, 6 Oct 2015 11:33:50 +0800 Subject: Changed buffer-per-socket to buffer-per-operation. This is a difficult tradeoff to measure. I think large datagrams won't be used very frequently. So it is better to not lock a large buffer to each socket object and instead allocate and deallocate for each operation receiving a datagram larger than UDP_DATAGRAMSIZE. --- doc/reference.html | 2 ++ doc/socket.html | 25 ++++++++++++++++++++++- doc/udp.html | 33 +++++++------------------------ src/select.c | 5 ++++- src/udp.c | 58 +++++++++++++++++++++++++----------------------------- src/udp.h | 2 -- test/testclnt.lua | 1 - 7 files changed, 64 insertions(+), 62 deletions(-) (limited to 'src/udp.h') diff --git a/doc/reference.html b/doc/reference.html index 6067ba6..878e7d2 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -147,6 +147,7 @@ Support, Manual"> connect, connect4, connect6, +_DATAGRAMSIZE, _DEBUG, dns, gettime, @@ -158,6 +159,7 @@ Support, Manual"> skip, sleep, _SETSIZE, +_SOCKETINVALID, source, tcp, tcp4, diff --git a/doc/socket.html b/doc/socket.html index e6a9bf8..8a81414 100644 --- a/doc/socket.html +++ b/doc/socket.html @@ -90,7 +90,7 @@ of connect are defined as simple helper functions that restrict the -

+

socket._DEBUG

@@ -99,6 +99,19 @@ This constant is set to true if the library was compiled with debug support.

+ + +

+socket._DATAGRAMSIZE +

+ +

+Default datagram size used by calls to +receive and +receivefrom. +(Unless changed in compile time, the value is 8192.) +

+

@@ -393,6 +406,16 @@ The maximum number of sockets that the select function can handle.

+ + +

+socket._SOCKETINVALID +

+ +

+The OS value for an invalid socket. +

+

diff --git a/doc/udp.html b/doc/udp.html index 22d7c72..9437c51 100644 --- a/doc/udp.html +++ b/doc/udp.html @@ -42,7 +42,7 @@

-socket.udp([buffersize]) +socket.udp()

@@ -62,13 +62,6 @@ The setpeername is used to connect the object.

-

-The optional buffersize parameter -specifies the size of the largest datagram that will -ever be received by the UDP object. The default value is -8192. -

-

In case of success, a new unconnected UDP object returned. In case of error, nil is returned, followed by @@ -92,7 +85,7 @@ href=#setoption>setoption will fail.

-socket.udp4([buffersize]) +socket.udp4()

@@ -112,13 +105,6 @@ The setpeername is used to connect the object.

-

-The optional buffersize parameter -specifies the size of the largest datagram that will -ever be received by the UDP object. The default value is -8192. -

-

In case of success, a new unconnected UDP object returned. In case of error, nil is returned, followed by @@ -128,7 +114,7 @@ an error message.

-socket.udp6([buffersize]) +socket.udp6()

@@ -148,13 +134,6 @@ The setpeername is used to connect the object.

-

-The optional buffersize parameter -specifies the size of the largest datagram that will -ever be received by the UDP object. The default value is -8192. -

-

In case of success, a new unconnected UDP object returned. In case of error, nil is returned, followed by @@ -261,8 +240,10 @@ the excess bytes are discarded. If there are less then size bytes available in the current datagram, the available bytes are returned. If size is omitted, the -buffersize argument at creation time is used -(which defaults to 8192 bytes). +compile-time constant socket._DATAGRAMSIZE is used +(it defaults to 8192 bytes). Larger sizes will cause a +temporary buffer to be allocated for the operation.

diff --git a/src/select.c b/src/select.c index d14c40a..9d133b7 100644 --- a/src/select.c +++ b/src/select.c @@ -39,7 +39,10 @@ static luaL_Reg func[] = { \*-------------------------------------------------------------------------*/ int select_open(lua_State *L) { lua_pushstring(L, "_SETSIZE"); - lua_pushnumber(L, FD_SETSIZE); + lua_pushinteger(L, FD_SETSIZE); + lua_rawset(L, -3); + lua_pushstring(L, "_SOCKETINVALID"); + lua_pushinteger(L, SOCKET_INVALID); lua_rawset(L, -3); luaL_setfuncs(L, func, 0); return 0; diff --git a/src/udp.c b/src/udp.c index 9c27b60..968dca8 100644 --- a/src/udp.c +++ b/src/udp.c @@ -41,7 +41,6 @@ static int meth_setpeername(lua_State *L); static int meth_close(lua_State *L); static int meth_setoption(lua_State *L); static int meth_getoption(lua_State *L); -static int meth_getbufferlength(lua_State *L); static int meth_settimeout(lua_State *L); static int meth_getfd(lua_State *L); static int meth_setfd(lua_State *L); @@ -64,7 +63,6 @@ static luaL_Reg udp_methods[] = { {"setfd", meth_setfd}, {"setoption", meth_setoption}, {"getoption", meth_getoption}, - {"getoption", meth_getbufferlength}, {"setpeername", meth_setpeername}, {"setsockname", meth_setsockname}, {"settimeout", meth_settimeout}, @@ -118,8 +116,7 @@ static luaL_Reg func[] = { /*-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/ -int udp_open(lua_State *L) -{ +int udp_open(lua_State *L) { /* create classes */ auxiliar_newclass(L, "udp{connected}", udp_methods); auxiliar_newclass(L, "udp{unconnected}", udp_methods); @@ -130,6 +127,10 @@ int udp_open(lua_State *L) auxiliar_add2group(L, "udp{unconnected}", "select{able}"); /* define library functions */ luaL_setfuncs(L, func, 0); + /* export default UDP size */ + lua_pushliteral(L, "_DATAGRAMSIZE"); + lua_pushinteger(L, UDP_DATAGRAMSIZE); + lua_rawset(L, -3); return 0; } @@ -205,30 +206,26 @@ static int meth_sendto(lua_State *L) { static int meth_receive(lua_State *L) { p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); char buf[UDP_DATAGRAMSIZE]; - size_t len = MAX(udp->len, UDP_DATAGRAMSIZE); - char *dgram = len > sizeof(buf)? udp->buf: buf; - size_t got, wanted = (size_t) luaL_optnumber(L, 2, len); + size_t got, wanted = (size_t) luaL_optnumber(L, 2, sizeof(buf)); + char *dgram = wanted > sizeof(buf)? (char *) malloc(wanted): buf; int err; p_timeout tm = &udp->tm; timeout_markstart(tm); - wanted = MIN(wanted, len); + if (!dgram) { + lua_pushnil(L); + lua_pushliteral(L, "out of memory"); + return 2; + } err = socket_recv(&udp->sock, dgram, wanted, &got, tm); /* Unlike TCP, recv() of zero is not closed, but a zero-length packet. */ - if (err != IO_DONE && err != IO_CLOSED ) { + if (err != IO_DONE && err != IO_CLOSED) { lua_pushnil(L); lua_pushstring(L, udp_strerror(err)); + if (wanted > sizeof(buf)) free(dgram); return 2; } lua_pushlstring(L, dgram, got); - return 1; -} - -/*-------------------------------------------------------------------------*\ -* Receives data from a UDP socket -\*-------------------------------------------------------------------------*/ -static int meth_getbufferlength(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); - lua_pushinteger(L, MAX(UDP_DATAGRAMSIZE, udp->len)); + if (wanted > sizeof(buf)) free(dgram); return 1; } @@ -238,9 +235,8 @@ static int meth_getbufferlength(lua_State *L) { static int meth_receivefrom(lua_State *L) { p_udp udp = (p_udp) auxiliar_checkclass(L, "udp{unconnected}", 1); char buf[UDP_DATAGRAMSIZE]; - size_t len = MAX(udp->len, UDP_DATAGRAMSIZE); - char *dgram = len > sizeof(buf)? udp->buf: buf; - size_t got, wanted = (size_t) luaL_optnumber(L, 2, len); + size_t got, wanted = (size_t) luaL_optnumber(L, 2, sizeof(buf)); + char *dgram = wanted > sizeof(buf)? (char *) malloc(wanted): buf; struct sockaddr_storage addr; socklen_t addr_len = sizeof(addr); char addrstr[INET6_ADDRSTRLEN]; @@ -248,13 +244,18 @@ static int meth_receivefrom(lua_State *L) { int err; p_timeout tm = &udp->tm; timeout_markstart(tm); - wanted = MIN(wanted, len); + if (!dgram) { + lua_pushnil(L); + lua_pushliteral(L, "out of memory"); + return 2; + } err = socket_recvfrom(&udp->sock, dgram, wanted, &got, (SA *) &addr, &addr_len, tm); /* Unlike TCP, recv() of zero is not closed, but a zero-length packet. */ if (err != IO_DONE && err != IO_CLOSED) { lua_pushnil(L); lua_pushstring(L, udp_strerror(err)); + if (wanted > sizeof(buf)) free(dgram); return 2; } err = getnameinfo((struct sockaddr *)&addr, addr_len, addrstr, @@ -262,19 +263,20 @@ static int meth_receivefrom(lua_State *L) { if (err) { lua_pushnil(L); lua_pushstring(L, gai_strerror(err)); + if (wanted > sizeof(buf)) free(dgram); return 2; } lua_pushlstring(L, dgram, got); lua_pushstring(L, addrstr); lua_pushinteger(L, (int) strtol(portstr, (char **) NULL, 10)); + if (wanted > sizeof(buf)) free(dgram); return 3; } /*-------------------------------------------------------------------------*\ * Returns family as string \*-------------------------------------------------------------------------*/ -static int meth_getfamily(lua_State *L) -{ +static int meth_getfamily(lua_State *L) { p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); if (udp->family == AF_INET6) { lua_pushliteral(L, "inet6"); @@ -419,19 +421,13 @@ static int meth_setsockname(lua_State *L) { * Creates a master udp object \*-------------------------------------------------------------------------*/ static int udp_create(lua_State *L, int family) { - p_udp udp = NULL; - /* optional length for private datagram buffer. this is useful when - * you need larger datagrams than UDP_DATAGRAMSIZE */ - size_t len = (size_t) luaL_optinteger(L, 1, 0); - if (len <= UDP_DATAGRAMSIZE) len = 0; /* allocate udp object */ - udp = (p_udp) lua_newuserdata(L, sizeof(t_udp) + len - 1); + p_udp udp = (p_udp) lua_newuserdata(L, sizeof(t_udp)); auxiliar_setclass(L, "udp{unconnected}", -1); /* if family is AF_UNSPEC, we leave the socket invalid and * store AF_UNSPEC into family. This will allow it to later be * replaced with an AF_INET6 or AF_INET socket upon first use. */ udp->sock = SOCKET_INVALID; - udp->len = len; timeout_init(&udp->tm, -1, -1); udp->family = family; if (family != AF_UNSPEC) { diff --git a/src/udp.h b/src/udp.h index da27a7a..be9b6a5 100644 --- a/src/udp.h +++ b/src/udp.h @@ -23,8 +23,6 @@ typedef struct t_udp_ { t_socket sock; t_timeout tm; int family; - size_t len; /* length of datagram buffer below */ - char buf[1]; /* allocate larger structure to hold actual buffer */ } t_udp; typedef t_udp *p_udp; diff --git a/test/testclnt.lua b/test/testclnt.lua index ee1201f..170e187 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua @@ -669,7 +669,6 @@ local udp_methods = { "settimeout" } - ------------------------------------------------------------------------ test_methods(socket.udp(), udp_methods) do local sock = socket.tcp6() -- cgit v1.2.3-55-g6feb From d71e6bc459ecb21f0cffc874c29176b762ecbd93 Mon Sep 17 00:00:00 2001 From: "E. Westbrook" Date: Wed, 27 Feb 2019 21:01:25 -0700 Subject: udp: pragma visibility --- src/udp.c | 6 +----- src/udp.h | 6 +++++- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/udp.h') diff --git a/src/udp.c b/src/udp.c index e59fa1b..62b6a20 100644 --- a/src/udp.c +++ b/src/udp.c @@ -4,10 +4,6 @@ \*=========================================================================*/ #include "luasocket.h" -#include "lua.h" -#include "lauxlib.h" -#include "compat.h" - #include "auxiliar.h" #include "socket.h" #include "inet.h" @@ -124,7 +120,7 @@ static luaL_Reg func[] = { /*-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/ -LUASOCKET_PRIVATE int udp_open(lua_State *L) { +int udp_open(lua_State *L) { /* create classes */ auxiliar_newclass(L, "udp{connected}", udp_methods); auxiliar_newclass(L, "udp{unconnected}", udp_methods); diff --git a/src/udp.h b/src/udp.h index be9b6a5..9e80ccd 100644 --- a/src/udp.h +++ b/src/udp.h @@ -12,7 +12,7 @@ * with a call to the setpeername function. The same function can be used to * break the connection. \*=========================================================================*/ -#include "lua.h" +#include "luasocket.h" #include "timeout.h" #include "socket.h" @@ -26,6 +26,10 @@ typedef struct t_udp_ { } t_udp; typedef t_udp *p_udp; +#pragma GCC visibility push(hidden) + int udp_open(lua_State *L); +#pragma GCC visibility pop + #endif /* UDP_H */ -- cgit v1.2.3-55-g6feb From 21514304be9e98a4386cb18542582068a59c5586 Mon Sep 17 00:00:00 2001 From: "E. Westbrook" Date: Thu, 28 Feb 2019 16:32:07 -0700 Subject: wrap visibility pragmas in #ifndef _WIN32 --- src/auxiliar.h | 4 ++++ src/buffer.h | 4 ++++ src/compat.h | 4 ++++ src/except.h | 4 ++++ src/inet.h | 4 ++++ src/io.h | 5 ++++- src/options.h | 4 ++++ src/select.h | 4 ++++ src/socket.h | 4 ++++ src/tcp.h | 4 ++++ src/timeout.c | 8 -------- src/timeout.h | 4 ++++ src/udp.h | 4 ++++ src/unixdgram.h | 4 ++++ src/unixstream.h | 4 ++++ src/wsocket.c | 8 -------- 16 files changed, 56 insertions(+), 17 deletions(-) (limited to 'src/udp.h') diff --git a/src/auxiliar.h b/src/auxiliar.h index 234b00a..e8c3ead 100644 --- a/src/auxiliar.h +++ b/src/auxiliar.h @@ -31,7 +31,9 @@ #include "luasocket.h" +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int auxiliar_open(lua_State *L); void auxiliar_newclass(lua_State *L, const char *classname, luaL_Reg *func); @@ -45,6 +47,8 @@ void *auxiliar_getgroupudata(lua_State *L, const char *groupname, int objidx); void *auxiliar_getclassudata(lua_State *L, const char *groupname, int objidx); int auxiliar_typeerror(lua_State *L, int narg, const char *tname); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* AUXILIAR_H */ diff --git a/src/buffer.h b/src/buffer.h index 4218ea0..a0901fc 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -33,7 +33,9 @@ typedef struct t_buffer_ { } t_buffer; typedef t_buffer *p_buffer; +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int buffer_open(lua_State *L); void buffer_init(p_buffer buf, p_io io, p_timeout tm); @@ -43,6 +45,8 @@ int buffer_meth_send(lua_State *L, p_buffer buf); int buffer_meth_receive(lua_State *L, p_buffer buf); int buffer_isempty(p_buffer buf); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* BUF_H */ diff --git a/src/compat.h b/src/compat.h index 8c32b07..fa2d7d7 100644 --- a/src/compat.h +++ b/src/compat.h @@ -3,12 +3,16 @@ #if LUA_VERSION_NUM==501 +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif void luasocket_setfuncs (lua_State *L, const luaL_Reg *l, int nup); void *luasocket_testudata ( lua_State *L, int arg, const char *tname); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #define luaL_setfuncs luasocket_setfuncs #define luaL_testudata luasocket_testudata diff --git a/src/except.h b/src/except.h index baa7b09..71c31fd 100644 --- a/src/except.h +++ b/src/except.h @@ -33,10 +33,14 @@ #include "luasocket.h" +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int except_open(lua_State *L); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif diff --git a/src/inet.h b/src/inet.h index 2e00e58..5618b61 100644 --- a/src/inet.h +++ b/src/inet.h @@ -22,7 +22,9 @@ #define LUASOCKET_INET_ATON #endif +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int inet_open(lua_State *L); @@ -47,6 +49,8 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt); int inet_pton(int af, const char *src, void *dst); #endif +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* INET_H */ diff --git a/src/io.h b/src/io.h index e08eb0e..b8a54df 100644 --- a/src/io.h +++ b/src/io.h @@ -56,12 +56,15 @@ typedef struct t_io_ { } t_io; typedef t_io *p_io; +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif void io_init(p_io io, p_send send, p_recv recv, p_error error, void *ctx); const char *io_strerror(int err); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* IO_H */ - diff --git a/src/options.h b/src/options.h index 1457f43..41f7337 100644 --- a/src/options.h +++ b/src/options.h @@ -18,7 +18,9 @@ typedef struct t_opt { } t_opt; typedef t_opt *p_opt; +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int opt_meth_setoption(lua_State *L, p_opt opt, p_socket ps); int opt_meth_getoption(lua_State *L, p_opt opt, p_socket ps); @@ -93,6 +95,8 @@ int opt_get_ip6_v6only(lua_State *L, p_socket ps); int opt_get_error(lua_State *L, p_socket ps); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif diff --git a/src/select.h b/src/select.h index 95272db..5d45fe7 100644 --- a/src/select.h +++ b/src/select.h @@ -10,10 +10,14 @@ * true if there is data ready for reading (required for buffered input). \*=========================================================================*/ +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int select_open(lua_State *L); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* SELECT_H */ diff --git a/src/socket.h b/src/socket.h index 4adc562..e541f27 100644 --- a/src/socket.h +++ b/src/socket.h @@ -36,7 +36,9 @@ typedef struct sockaddr SA; * interface to sockets \*=========================================================================*/ +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int socket_waitfd(p_socket ps, int sw, p_timeout tm); int socket_open(void); @@ -64,6 +66,8 @@ const char *socket_strerror(int err); const char *socket_ioerror(p_socket ps, int err); const char *socket_gaistrerror(int err); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* SOCKET_H */ diff --git a/src/tcp.h b/src/tcp.h index 9b12b53..9b282ef 100644 --- a/src/tcp.h +++ b/src/tcp.h @@ -30,10 +30,14 @@ typedef struct t_tcp_ { typedef t_tcp *p_tcp; +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int tcp_open(lua_State *L); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* TCP_H */ diff --git a/src/timeout.c b/src/timeout.c index 0e3ee27..2bdc069 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -26,10 +26,6 @@ #define MAX(x, y) ((x) > (y) ? x : y) #endif -#ifndef _WIN32 -#pragma GCC visibility push(hidden) -#endif - /*=========================================================================*\ * Internal function prototypes \*=========================================================================*/ @@ -228,7 +224,3 @@ int timeout_lua_sleep(lua_State *L) return 0; } #endif - -#ifndef _WIN32 -#pragma GCC visibility pop -#endif diff --git a/src/timeout.h b/src/timeout.h index df05eaf..9e5250d 100644 --- a/src/timeout.h +++ b/src/timeout.h @@ -14,7 +14,9 @@ typedef struct t_timeout_ { } t_timeout; typedef t_timeout *p_timeout; +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif void timeout_init(p_timeout tm, double block, double total); double timeout_get(p_timeout tm); @@ -29,7 +31,9 @@ int timeout_open(lua_State *L); int timeout_meth_settimeout(lua_State *L, p_timeout tm); int timeout_meth_gettimeout(lua_State *L, p_timeout tm); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #define timeout_iszero(tm) ((tm)->block == 0.0) diff --git a/src/udp.h b/src/udp.h index 9e80ccd..07d5247 100644 --- a/src/udp.h +++ b/src/udp.h @@ -26,10 +26,14 @@ typedef struct t_udp_ { } t_udp; typedef t_udp *p_udp; +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int udp_open(lua_State *L); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* UDP_H */ diff --git a/src/unixdgram.h b/src/unixdgram.h index 433fe25..a1a0166 100644 --- a/src/unixdgram.h +++ b/src/unixdgram.h @@ -15,10 +15,14 @@ #include "unix.h" +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int unixdgram_open(lua_State *L); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* UNIXDGRAM_H */ diff --git a/src/unixstream.h b/src/unixstream.h index 8ffba8f..7916aff 100644 --- a/src/unixstream.h +++ b/src/unixstream.h @@ -16,10 +16,14 @@ \*=========================================================================*/ #include "unix.h" +#ifndef _WIN32 #pragma GCC visibility push(hidden) +#endif int unixstream_open(lua_State *L); +#ifndef _WIN32 #pragma GCC visibility pop +#endif #endif /* UNIXSTREAM_H */ diff --git a/src/wsocket.c b/src/wsocket.c index 1da984c..20da330 100755 --- a/src/wsocket.c +++ b/src/wsocket.c @@ -12,10 +12,6 @@ #include "socket.h" #include "pierror.h" -#ifndef _WIN32 -#pragma GCC visibility push(hidden) -#endif - /* WinSock doesn't have a strerror... */ static const char *wstrerror(int err); @@ -436,7 +432,3 @@ const char *socket_gaistrerror(int err) { default: return gai_strerror(err); } } - -#ifndef _WIN32 -#pragma GCC visibility pop -#endif -- cgit v1.2.3-55-g6feb