there is no need for a size for Cblocks

This commit is contained in:
Roberto Ierusalimschy
1999-05-11 17:08:20 -03:00
parent 6eb1399a1c
commit 705eae9fe4
3 changed files with 12 additions and 23 deletions

29
lapi.c
View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lapi.c,v 1.42 1999/03/26 13:14:00 roberto Exp roberto $ ** $Id: lapi.c,v 1.43 1999/05/11 14:19:32 roberto Exp roberto $
** Lua API ** Lua API
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -167,15 +167,12 @@ lua_Object lua_gettable (void)
} }
lua_Object lua_rawgettable (void) lua_Object lua_rawgettable (void) {
{
checkCparams(2); checkCparams(2);
if (ttype(L->stack.top-2) != LUA_T_ARRAY) if (ttype(L->stack.top-2) != LUA_T_ARRAY)
lua_error("indexed expression not a table in rawgettable"); lua_error("indexed expression not a table in rawgettable");
else { *(L->stack.top-2) = *luaH_get(avalue(L->stack.top-2), L->stack.top-1);
*(L->stack.top-2) = *luaH_get(avalue(L->stack.top-2), L->stack.top-1); --L->stack.top;
--L->stack.top;
}
return put_luaObjectonTop(); return put_luaObjectonTop();
} }
@@ -368,14 +365,11 @@ void luaA_pushobject (TObject *o)
incr_top; incr_top;
} }
void lua_pushobject (lua_Object o) void lua_pushobject (lua_Object o) {
{
if (o == LUA_NOOBJECT) if (o == LUA_NOOBJECT)
lua_error("API error - attempt to push a NOOBJECT"); lua_error("API error - attempt to push a NOOBJECT");
else { set_normalized(L->stack.top, Address(o));
set_normalized(L->stack.top, Address(o)); incr_top;
incr_top;
}
} }
@@ -638,16 +632,13 @@ char *lua_getobjname (lua_Object o, char **name)
#ifndef MAX_C_BLOCKS #ifndef MAX_C_BLOCKS
#define MAX_C_BLOCKS 500 #define MAX_C_BLOCKS 1000
#endif #endif
void lua_beginblock (void) { void lua_beginblock (void) {
if (L->numCblocks >= L->sizeCblocks) { luaM_growvector(L->Cblocks, L->numCblocks, 1, struct C_Lua_Stack,
luaM_growvector(L->Cblocks, L->numCblocks, 1, struct C_Lua_Stack, "too many nested blocks", MAX_C_BLOCKS);
"too many nested blocks", MAX_C_BLOCKS);
L->sizeCblocks++;
}
L->Cblocks[L->numCblocks] = L->Cstack; L->Cblocks[L->numCblocks] = L->Cstack;
L->numCblocks++; L->numCblocks++;
} }

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lstate.c,v 1.10 1999/04/13 19:30:51 roberto Exp roberto $ ** $Id: lstate.c,v 1.11 1999/05/11 14:19:32 roberto Exp roberto $
** Global State ** Global State
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -33,7 +33,6 @@ void lua_open (void)
L->Mbuffsize = 0; L->Mbuffsize = 0;
L->Mbuffnext = 0; L->Mbuffnext = 0;
L->Cblocks = NULL; L->Cblocks = NULL;
L->sizeCblocks = 0;
L->numCblocks = 0; L->numCblocks = 0;
L->debug = 0; L->debug = 0;
L->callhook = NULL; L->callhook = NULL;

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lstate.h,v 1.17 1999/05/10 13:54:01 roberto Exp roberto $ ** $Id: lstate.h,v 1.18 1999/05/11 14:19:32 roberto Exp roberto $
** Global State ** Global State
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -68,7 +68,6 @@ struct lua_State {
int Mbuffsize; /* size of Mbuffer */ int Mbuffsize; /* size of Mbuffer */
int Mbuffnext; /* next position to fill in Mbuffer */ int Mbuffnext; /* next position to fill in Mbuffer */
struct C_Lua_Stack *Cblocks; struct C_Lua_Stack *Cblocks;
int sizeCblocks; /* size of Cblocks */
int numCblocks; /* number of nested Cblocks */ int numCblocks; /* number of nested Cblocks */
int debug; int debug;
lua_CHFunction callhook; lua_CHFunction callhook;