From 705eae9fe49956ec8247cc8737b908e84d25bb9f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 11 May 1999 17:08:20 -0300 Subject: [PATCH] there is no need for a size for Cblocks --- lapi.c | 29 ++++++++++------------------- lstate.c | 3 +-- lstate.h | 3 +-- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/lapi.c b/lapi.c index e71eb4ae..45fa7f27 100644 --- a/lapi.c +++ b/lapi.c @@ -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 ** 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); if (ttype(L->stack.top-2) != LUA_T_ARRAY) 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; - } + *(L->stack.top-2) = *luaH_get(avalue(L->stack.top-2), L->stack.top-1); + --L->stack.top; return put_luaObjectonTop(); } @@ -368,14 +365,11 @@ void luaA_pushobject (TObject *o) incr_top; } -void lua_pushobject (lua_Object o) -{ +void lua_pushobject (lua_Object o) { if (o == LUA_NOOBJECT) lua_error("API error - attempt to push a NOOBJECT"); - else { - set_normalized(L->stack.top, Address(o)); - incr_top; - } + set_normalized(L->stack.top, Address(o)); + incr_top; } @@ -638,16 +632,13 @@ char *lua_getobjname (lua_Object o, char **name) #ifndef MAX_C_BLOCKS -#define MAX_C_BLOCKS 500 +#define MAX_C_BLOCKS 1000 #endif void lua_beginblock (void) { - if (L->numCblocks >= L->sizeCblocks) { - luaM_growvector(L->Cblocks, L->numCblocks, 1, struct C_Lua_Stack, - "too many nested blocks", MAX_C_BLOCKS); - L->sizeCblocks++; - } + luaM_growvector(L->Cblocks, L->numCblocks, 1, struct C_Lua_Stack, + "too many nested blocks", MAX_C_BLOCKS); L->Cblocks[L->numCblocks] = L->Cstack; L->numCblocks++; } diff --git a/lstate.c b/lstate.c index 931f0c5a..1a7fe22e 100644 --- a/lstate.c +++ b/lstate.c @@ -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 ** See Copyright Notice in lua.h */ @@ -33,7 +33,6 @@ void lua_open (void) L->Mbuffsize = 0; L->Mbuffnext = 0; L->Cblocks = NULL; - L->sizeCblocks = 0; L->numCblocks = 0; L->debug = 0; L->callhook = NULL; diff --git a/lstate.h b/lstate.h index 541c473d..2690a1f9 100644 --- a/lstate.h +++ b/lstate.h @@ -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 ** See Copyright Notice in lua.h */ @@ -68,7 +68,6 @@ struct lua_State { int Mbuffsize; /* size of Mbuffer */ int Mbuffnext; /* next position to fill in Mbuffer */ struct C_Lua_Stack *Cblocks; - int sizeCblocks; /* size of Cblocks */ int numCblocks; /* number of nested Cblocks */ int debug; lua_CHFunction callhook;