aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-05-11 17:08:20 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-05-11 17:08:20 -0300
commit705eae9fe49956ec8247cc8737b908e84d25bb9f (patch)
treea7b2ea9cba341ac3d4e18714f3b28a603dff1d2b
parent6eb1399a1c662f45ab5511a5e7d35fdb967ec076 (diff)
downloadlua-705eae9fe49956ec8247cc8737b908e84d25bb9f.tar.gz
lua-705eae9fe49956ec8247cc8737b908e84d25bb9f.tar.bz2
lua-705eae9fe49956ec8247cc8737b908e84d25bb9f.zip
there is no need for a size for Cblocks
-rw-r--r--lapi.c29
-rw-r--r--lstate.c3
-rw-r--r--lstate.h3
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 @@
1/* 1/*
2** $Id: lapi.c,v 1.42 1999/03/26 13:14:00 roberto Exp roberto $ 2** $Id: lapi.c,v 1.43 1999/05/11 14:19:32 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -167,15 +167,12 @@ lua_Object lua_gettable (void)
167} 167}
168 168
169 169
170lua_Object lua_rawgettable (void) 170lua_Object lua_rawgettable (void) {
171{
172 checkCparams(2); 171 checkCparams(2);
173 if (ttype(L->stack.top-2) != LUA_T_ARRAY) 172 if (ttype(L->stack.top-2) != LUA_T_ARRAY)
174 lua_error("indexed expression not a table in rawgettable"); 173 lua_error("indexed expression not a table in rawgettable");
175 else { 174 *(L->stack.top-2) = *luaH_get(avalue(L->stack.top-2), L->stack.top-1);
176 *(L->stack.top-2) = *luaH_get(avalue(L->stack.top-2), L->stack.top-1); 175 --L->stack.top;
177 --L->stack.top;
178 }
179 return put_luaObjectonTop(); 176 return put_luaObjectonTop();
180} 177}
181 178
@@ -368,14 +365,11 @@ void luaA_pushobject (TObject *o)
368 incr_top; 365 incr_top;
369} 366}
370 367
371void lua_pushobject (lua_Object o) 368void lua_pushobject (lua_Object o) {
372{
373 if (o == LUA_NOOBJECT) 369 if (o == LUA_NOOBJECT)
374 lua_error("API error - attempt to push a NOOBJECT"); 370 lua_error("API error - attempt to push a NOOBJECT");
375 else { 371 set_normalized(L->stack.top, Address(o));
376 set_normalized(L->stack.top, Address(o)); 372 incr_top;
377 incr_top;
378 }
379} 373}
380 374
381 375
@@ -638,16 +632,13 @@ char *lua_getobjname (lua_Object o, char **name)
638 632
639 633
640#ifndef MAX_C_BLOCKS 634#ifndef MAX_C_BLOCKS
641#define MAX_C_BLOCKS 500 635#define MAX_C_BLOCKS 1000
642#endif 636#endif
643 637
644 638
645void lua_beginblock (void) { 639void lua_beginblock (void) {
646 if (L->numCblocks >= L->sizeCblocks) { 640 luaM_growvector(L->Cblocks, L->numCblocks, 1, struct C_Lua_Stack,
647 luaM_growvector(L->Cblocks, L->numCblocks, 1, struct C_Lua_Stack, 641 "too many nested blocks", MAX_C_BLOCKS);
648 "too many nested blocks", MAX_C_BLOCKS);
649 L->sizeCblocks++;
650 }
651 L->Cblocks[L->numCblocks] = L->Cstack; 642 L->Cblocks[L->numCblocks] = L->Cstack;
652 L->numCblocks++; 643 L->numCblocks++;
653} 644}
diff --git a/lstate.c b/lstate.c
index 931f0c5a..1a7fe22e 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 1.10 1999/04/13 19:30:51 roberto Exp roberto $ 2** $Id: lstate.c,v 1.11 1999/05/11 14:19:32 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -33,7 +33,6 @@ void lua_open (void)
33 L->Mbuffsize = 0; 33 L->Mbuffsize = 0;
34 L->Mbuffnext = 0; 34 L->Mbuffnext = 0;
35 L->Cblocks = NULL; 35 L->Cblocks = NULL;
36 L->sizeCblocks = 0;
37 L->numCblocks = 0; 36 L->numCblocks = 0;
38 L->debug = 0; 37 L->debug = 0;
39 L->callhook = NULL; 38 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 @@
1/* 1/*
2** $Id: lstate.h,v 1.17 1999/05/10 13:54:01 roberto Exp roberto $ 2** $Id: lstate.h,v 1.18 1999/05/11 14:19:32 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -68,7 +68,6 @@ struct lua_State {
68 int Mbuffsize; /* size of Mbuffer */ 68 int Mbuffsize; /* size of Mbuffer */
69 int Mbuffnext; /* next position to fill in Mbuffer */ 69 int Mbuffnext; /* next position to fill in Mbuffer */
70 struct C_Lua_Stack *Cblocks; 70 struct C_Lua_Stack *Cblocks;
71 int sizeCblocks; /* size of Cblocks */
72 int numCblocks; /* number of nested Cblocks */ 71 int numCblocks; /* number of nested Cblocks */
73 int debug; 72 int debug;
74 lua_CHFunction callhook; 73 lua_CHFunction callhook;