diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/except.c | 9 | ||||
-rw-r--r-- | src/tcp.c | 4 | ||||
-rw-r--r-- | src/unix.c | 4 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/except.c b/src/except.c index ad03817..80d7e5d 100644 --- a/src/except.c +++ b/src/except.c | |||
@@ -4,8 +4,9 @@ | |||
4 | * | 4 | * |
5 | * RCS ID: $Id$ | 5 | * RCS ID: $Id$ |
6 | \*=========================================================================*/ | 6 | \*=========================================================================*/ |
7 | #include <lauxlib.h> | ||
8 | #include <stdio.h> | 7 | #include <stdio.h> |
8 | #include <lua.h> | ||
9 | #include <lauxlib.h> | ||
9 | 10 | ||
10 | #include "except.h" | 11 | #include "except.h" |
11 | 12 | ||
@@ -14,7 +15,7 @@ | |||
14 | \*=========================================================================*/ | 15 | \*=========================================================================*/ |
15 | static int global_protect(lua_State *L); | 16 | static int global_protect(lua_State *L); |
16 | static int global_newtry(lua_State *L); | 17 | static int global_newtry(lua_State *L); |
17 | static int protected(lua_State *L); | 18 | static int protected_(lua_State *L); |
18 | static int finalize(lua_State *L); | 19 | static int finalize(lua_State *L); |
19 | static int do_nothing(lua_State *L); | 20 | static int do_nothing(lua_State *L); |
20 | 21 | ||
@@ -53,7 +54,7 @@ static int global_newtry(lua_State *L) { | |||
53 | /*-------------------------------------------------------------------------*\ | 54 | /*-------------------------------------------------------------------------*\ |
54 | * Protect factory | 55 | * Protect factory |
55 | \*-------------------------------------------------------------------------*/ | 56 | \*-------------------------------------------------------------------------*/ |
56 | static int protected(lua_State *L) { | 57 | static int protected_(lua_State *L) { |
57 | lua_pushvalue(L, lua_upvalueindex(1)); | 58 | lua_pushvalue(L, lua_upvalueindex(1)); |
58 | lua_insert(L, 1); | 59 | lua_insert(L, 1); |
59 | if (lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0) != 0) { | 60 | if (lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0) != 0) { |
@@ -64,7 +65,7 @@ static int protected(lua_State *L) { | |||
64 | } | 65 | } |
65 | 66 | ||
66 | static int global_protect(lua_State *L) { | 67 | static int global_protect(lua_State *L) { |
67 | lua_pushcclosure(L, protected, 1); | 68 | lua_pushcclosure(L, protected_, 1); |
68 | return 1; | 69 | return 1; |
69 | } | 70 | } |
70 | 71 | ||
@@ -117,7 +117,7 @@ static int meth_receive(lua_State *L) | |||
117 | \*-------------------------------------------------------------------------*/ | 117 | \*-------------------------------------------------------------------------*/ |
118 | static int meth_setoption(lua_State *L) | 118 | static int meth_setoption(lua_State *L) |
119 | { | 119 | { |
120 | p_tcp tcp = aux_checkgroup(L, "tcp{any}", 1); | 120 | p_tcp tcp = (p_tcp) aux_checkgroup(L, "tcp{any}", 1); |
121 | return opt_meth_setoption(L, opt, &tcp->sock); | 121 | return opt_meth_setoption(L, opt, &tcp->sock); |
122 | } | 122 | } |
123 | 123 | ||
@@ -158,7 +158,7 @@ static int meth_accept(lua_State *L) | |||
158 | const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm); | 158 | const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm); |
159 | /* if successful, push client socket */ | 159 | /* if successful, push client socket */ |
160 | if (!err) { | 160 | if (!err) { |
161 | p_tcp clnt = lua_newuserdata(L, sizeof(t_tcp)); | 161 | p_tcp clnt = (p_tcp) lua_newuserdata(L, sizeof(t_tcp)); |
162 | aux_setclass(L, "tcp{client}", -1); | 162 | aux_setclass(L, "tcp{client}", -1); |
163 | /* initialize structure fields */ | 163 | /* initialize structure fields */ |
164 | sock_setnonblocking(&sock); | 164 | sock_setnonblocking(&sock); |
@@ -111,7 +111,7 @@ static int meth_receive(lua_State *L) { | |||
111 | * Just call option handler | 111 | * Just call option handler |
112 | \*-------------------------------------------------------------------------*/ | 112 | \*-------------------------------------------------------------------------*/ |
113 | static int meth_setoption(lua_State *L) { | 113 | static int meth_setoption(lua_State *L) { |
114 | p_unix unix = aux_checkgroup(L, "unix{any}", 1); | 114 | p_unix unix = (p_unix) aux_checkgroup(L, "unix{any}", 1); |
115 | return opt_meth_setoption(L, opt, &unix->sock); | 115 | return opt_meth_setoption(L, opt, &unix->sock); |
116 | } | 116 | } |
117 | 117 | ||
@@ -148,7 +148,7 @@ static int meth_accept(lua_State *L) { | |||
148 | const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm); | 148 | const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm); |
149 | /* if successful, push client socket */ | 149 | /* if successful, push client socket */ |
150 | if (!err) { | 150 | if (!err) { |
151 | p_unix clnt = lua_newuserdata(L, sizeof(t_unix)); | 151 | p_unix clnt = (p_unix) lua_newuserdata(L, sizeof(t_unix)); |
152 | aux_setclass(L, "unix{client}", -1); | 152 | aux_setclass(L, "unix{client}", -1); |
153 | /* initialize structure fields */ | 153 | /* initialize structure fields */ |
154 | sock_setnonblocking(&sock); | 154 | sock_setnonblocking(&sock); |