diff --git a/src/inet.c b/src/inet.c index 25482a3..1a411f6 100644 --- a/src/inet.c +++ b/src/inet.c @@ -199,7 +199,7 @@ static int inet_global_getaddrinfo(lua_State *L) lua_pushliteral(L, "family"); lua_pushliteral(L, "inet6"); lua_settable(L, -3); - break;; + break; } lua_pushliteral(L, "addr"); lua_pushstring(L, hbuf); @@ -487,8 +487,7 @@ const char *inet_trybind(p_socket ps, const char *address, const char *serv, } /*-------------------------------------------------------------------------*\ -* Some systems do not provide this so that we provide our own. It's not -* marvelously fast, but it works just fine. +* Some systems do not provide these so that we provide our own. \*-------------------------------------------------------------------------*/ #ifdef LUASOCKET_INET_ATON int inet_aton(const char *cp, struct in_addr *inp) @@ -512,34 +511,7 @@ int inet_aton(const char *cp, struct in_addr *inp) } #endif -/*-------------------------------------------------------------------------*\ -* inet_ntop/inet_pton for MinGW from -* http://mingw-users.1079350.n2.nabble.com/IPv6-getaddrinfo-amp-inet-ntop-td5891996.html -\*-------------------------------------------------------------------------*/ - #ifdef LUASOCKET_INET_PTON -const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt) -{ - if (af == AF_INET) { - struct sockaddr_in in; - memset(&in, 0, sizeof(in)); - in.sin_family = AF_INET; - memcpy(&in.sin_addr, src, sizeof(struct in_addr)); - getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in), - dst, cnt, NULL, 0, NI_NUMERICHOST); - return dst; - } else if (af == AF_INET6) { - struct sockaddr_in6 in; - memset(&in, 0, sizeof(in)); - in.sin6_family = AF_INET6; - memcpy(&in.sin6_addr, src, sizeof(struct in_addr6)); - getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in6), - dst, cnt, NULL, 0, NI_NUMERICHOST); - return dst; - } - return NULL; -} - int inet_pton(int af, const char *src, void *dst) { struct addrinfo hints, *res; diff --git a/src/options.c b/src/options.c index 55b65a7..8ac2a14 100644 --- a/src/options.c +++ b/src/options.c @@ -285,14 +285,6 @@ static int opt_ip6_setmembership(lua_State *L, p_socket ps, int level, int name) if (!lua_isnil(L, -1)) { if (lua_isnumber(L, -1)) { val.ipv6mr_interface = (unsigned int) lua_tonumber(L, -1); -#if 0 - } else if (lua_isstring(L, -1)) { - if (!(val.ipv6mr_interface = if_nametoindex(lua_tostring(L, -1)))) { - lua_pushnil(L); - lua_pushstring(L, "nonexistent interface"); - return 2; - } -#endif } else luaL_argerror(L, -1, "number 'interface' field expected"); } diff --git a/src/socket.lua b/src/socket.lua index f2fb8a3..3913e6f 100644 --- a/src/socket.lua +++ b/src/socket.lua @@ -146,4 +146,4 @@ sourcet["default"] = sourcet["until-closed"] _M.source = _M.choose(sourcet) -return _M \ No newline at end of file +return _M