lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 2779e81fbbdebf8b7cac97c167ff109bad537c4b
parent 30f6e658d2071d23309e4ac70dd8ec199049aff4
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Mon, 11 Sep 2000 16:45:05 -0300

API functions check stack overflow

Diffstat:
Mlapi.c | 7++++---
Mltm.c | 5+++--
2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lapi.c b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 1.93 2000/08/31 21:01:43 roberto Exp roberto $ +** $Id: lapi.c,v 1.94 2000/09/05 19:33:32 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -30,7 +30,7 @@ const char lua_ident[] = "$Lua: " LUA_VERSION " " LUA_COPYRIGHT " $\n" #define Index(L,i) ((i) >= 0 ? (L->Cbase+((i)-1)) : (L->top+(i))) -#define api_incr_top(L) (++L->top) +#define api_incr_top(L) incr_top @@ -250,7 +250,8 @@ void lua_pushusertag (lua_State *L, void *u, int tag) { /* ORDER LUA_T */ void lua_getglobal (lua_State *L, const char *name) { StkId top = L->top; *top = *luaV_getglobal(L, luaS_new(L, name)); - L->top = top+1; + L->top = top; + api_incr_top(L); } diff --git a/ltm.c b/ltm.c @@ -1,5 +1,5 @@ /* -** $Id: ltm.c,v 1.46 2000/08/09 19:16:57 roberto Exp roberto $ +** $Id: ltm.c,v 1.47 2000/09/05 19:33:32 roberto Exp roberto $ ** Tag methods ** See Copyright Notice in lua.h */ @@ -11,6 +11,7 @@ #include "lua.h" #include "lauxlib.h" +#include "ldo.h" #include "lmem.h" #include "lobject.h" #include "lstate.h" @@ -127,7 +128,7 @@ void lua_gettagmethod (lua_State *L, int t, const char *event) { *L->top = *luaT_getim(L, t,e); else ttype(L->top) = TAG_NIL; - L->top++; + incr_top; }