aboutsummaryrefslogtreecommitdiff
path: root/src/inet.c
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2002-12-02 23:34:41 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2002-12-02 23:34:41 +0000
commitd7e80592a69c076991ed4f4cc15d5390e14d1f0b (patch)
tree5fd9c99742b4a03e6a66f940a1f86f98d4db50c8 /src/inet.c
parentb796207ce06a66b04cce6686b3fa664c06703995 (diff)
downloadluasocket-d7e80592a69c076991ed4f4cc15d5390e14d1f0b.tar.gz
luasocket-d7e80592a69c076991ed4f4cc15d5390e14d1f0b.tar.bz2
luasocket-d7e80592a69c076991ed4f4cc15d5390e14d1f0b.zip
Already compiling and running for Lua 5.0 (alpha)
Diffstat (limited to 'src/inet.c')
-rw-r--r--src/inet.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/inet.c b/src/inet.c
index 5003ed9..3e89e88 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -38,9 +38,9 @@ static int inet_aton(cchar *cp, struct in_addr *inp);
38void inet_open(lua_State *L) 38void inet_open(lua_State *L)
39{ 39{
40 lua_pushcfunction(L, inet_lua_toip); 40 lua_pushcfunction(L, inet_lua_toip);
41 lua_setglobal(L, "toip"); 41 priv_newglobal(L, "toip");
42 lua_pushcfunction(L, inet_lua_tohostname); 42 lua_pushcfunction(L, inet_lua_tohostname);
43 lua_setglobal(L, "tohostname"); 43 priv_newglobal(L, "tohostname");
44 priv_newglobalmethod(L, "getsockname"); 44 priv_newglobalmethod(L, "getsockname");
45 priv_newglobalmethod(L, "getpeername"); 45 priv_newglobalmethod(L, "getpeername");
46} 46}
@@ -145,7 +145,7 @@ static int inet_lua_getpeername(lua_State *L)
145{ 145{
146 p_sock sock = (p_sock) lua_touserdata(L, 1); 146 p_sock sock = (p_sock) lua_touserdata(L, 1);
147 struct sockaddr_in peer; 147 struct sockaddr_in peer;
148 size_t peer_len = sizeof(peer); 148 int peer_len = sizeof(peer);
149 if (getpeername(sock->fd, (SA *) &peer, &peer_len) < 0) { 149 if (getpeername(sock->fd, (SA *) &peer, &peer_len) < 0) {
150 lua_pushnil(L); 150 lua_pushnil(L);
151 return 1; 151 return 1;
@@ -167,7 +167,7 @@ static int inet_lua_getsockname(lua_State *L)
167{ 167{
168 p_sock sock = (p_sock) lua_touserdata(L, 1); 168 p_sock sock = (p_sock) lua_touserdata(L, 1);
169 struct sockaddr_in local; 169 struct sockaddr_in local;
170 size_t local_len = sizeof(local); 170 int local_len = sizeof(local);
171 if (getsockname(sock->fd, (SA *) &local, &local_len) < 0) { 171 if (getsockname(sock->fd, (SA *) &local, &local_len) < 0) {
172 lua_pushnil(L); 172 lua_pushnil(L);
173 return 1; 173 return 1;