Compiles with g++.
This commit is contained in:
parent
a7d5362caf
commit
197aef23ce
5 changed files with 21 additions and 12 deletions
|
@ -4,8 +4,9 @@
|
|||
*
|
||||
* RCS ID: $Id$
|
||||
\*=========================================================================*/
|
||||
#include <lauxlib.h>
|
||||
#include <stdio.h>
|
||||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
|
||||
#include "except.h"
|
||||
|
||||
|
@ -14,7 +15,7 @@
|
|||
\*=========================================================================*/
|
||||
static int global_protect(lua_State *L);
|
||||
static int global_newtry(lua_State *L);
|
||||
static int protected(lua_State *L);
|
||||
static int protected_(lua_State *L);
|
||||
static int finalize(lua_State *L);
|
||||
static int do_nothing(lua_State *L);
|
||||
|
||||
|
@ -53,7 +54,7 @@ static int global_newtry(lua_State *L) {
|
|||
/*-------------------------------------------------------------------------*\
|
||||
* Protect factory
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static int protected(lua_State *L) {
|
||||
static int protected_(lua_State *L) {
|
||||
lua_pushvalue(L, lua_upvalueindex(1));
|
||||
lua_insert(L, 1);
|
||||
if (lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0) != 0) {
|
||||
|
@ -64,7 +65,7 @@ static int protected(lua_State *L) {
|
|||
}
|
||||
|
||||
static int global_protect(lua_State *L) {
|
||||
lua_pushcclosure(L, protected, 1);
|
||||
lua_pushcclosure(L, protected_, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ static int meth_receive(lua_State *L)
|
|||
\*-------------------------------------------------------------------------*/
|
||||
static int meth_setoption(lua_State *L)
|
||||
{
|
||||
p_tcp tcp = aux_checkgroup(L, "tcp{any}", 1);
|
||||
p_tcp tcp = (p_tcp) aux_checkgroup(L, "tcp{any}", 1);
|
||||
return opt_meth_setoption(L, opt, &tcp->sock);
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ static int meth_accept(lua_State *L)
|
|||
const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm);
|
||||
/* if successful, push client socket */
|
||||
if (!err) {
|
||||
p_tcp clnt = lua_newuserdata(L, sizeof(t_tcp));
|
||||
p_tcp clnt = (p_tcp) lua_newuserdata(L, sizeof(t_tcp));
|
||||
aux_setclass(L, "tcp{client}", -1);
|
||||
/* initialize structure fields */
|
||||
sock_setnonblocking(&sock);
|
||||
|
|
|
@ -111,7 +111,7 @@ static int meth_receive(lua_State *L) {
|
|||
* Just call option handler
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static int meth_setoption(lua_State *L) {
|
||||
p_unix unix = aux_checkgroup(L, "unix{any}", 1);
|
||||
p_unix unix = (p_unix) aux_checkgroup(L, "unix{any}", 1);
|
||||
return opt_meth_setoption(L, opt, &unix->sock);
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ static int meth_accept(lua_State *L) {
|
|||
const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm);
|
||||
/* if successful, push client socket */
|
||||
if (!err) {
|
||||
p_unix clnt = lua_newuserdata(L, sizeof(t_unix));
|
||||
p_unix clnt = (p_unix) lua_newuserdata(L, sizeof(t_unix));
|
||||
aux_setclass(L, "unix{client}", -1);
|
||||
/* initialize structure fields */
|
||||
sock_setnonblocking(&sock);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue