no more 'ccall' nor 'cpcall' functions. (With light C functions they

are obsolete.)
This commit is contained in:
Roberto Ierusalimschy
2010-04-14 12:14:21 -03:00
parent 7dfa4cd655
commit afdb19ac82
5 changed files with 8 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lstate.c,v 2.78 2010/04/08 17:16:46 roberto Exp roberto $
** $Id: lstate.c,v 2.79 2010/04/12 16:07:06 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@@ -113,23 +113,10 @@ static void freestack (lua_State *L) {
}
/*
** Calls the function in variable pointed to by userdata in first argument
** (Userdata cannot point directly to the function because pointer to
** function is not compatible with void*.)
*/
static int ccall (lua_State *L) {
lua_CFunction f = *(lua_CFunction *)lua_touserdata(L, 1);
lua_remove(L, 1); /* remove f from stack */
return f(L);
}
/*
** Create registry table and its predefined values
*/
static void init_registry (lua_State *L, global_State *g) {
Closure *cp;
TValue mt;
/* create registry */
Table *registry = luaH_new(L);
@@ -138,11 +125,6 @@ static void init_registry (lua_State *L, global_State *g) {
/* registry[LUA_RIDX_MAINTHREAD] = L */
setthvalue(L, &mt, L);
setobj2t(L, luaH_setint(L, registry, LUA_RIDX_MAINTHREAD), &mt);
/* registry[LUA_RIDX_CCALL] = ccall */
cp = luaF_newCclosure(L, 0);
cp->c.f = ccall;
setclvalue(L, &mt, cp);
setobj2t(L, luaH_setint(L, registry, LUA_RIDX_CCALL), &mt);
/* registry[LUA_RIDX_GLOBALS] = table of globals */
sethvalue(L, &mt, luaH_new(L));
setobj2t(L, luaH_setint(L, registry, LUA_RIDX_GLOBALS), &mt);