summaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-03-25 16:45:06 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-03-25 16:45:06 -0300
commit44a5484d7305d9ed1ff3811d7476730cb85f0df1 (patch)
tree6831cb117f5b8f13d3f5f065a616a8f2c80f034c /ldo.c
parent801aaf37b14a1fad5bb49c9a4200d25680152471 (diff)
downloadlua-44a5484d7305d9ed1ff3811d7476730cb85f0df1.tar.gz
lua-44a5484d7305d9ed1ff3811d7476730cb85f0df1.tar.bz2
lua-44a5484d7305d9ed1ff3811d7476730cb85f0df1.zip
small bug (L->ci->top may be larger than L->top...)
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ldo.c b/ldo.c
index 37dac3b5..3e0053f4 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.165 2002/03/20 12:52:32 roberto Exp roberto $ 2** $Id: ldo.c,v 1.166 2002/03/25 17:47:14 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -109,15 +109,16 @@ static void luaD_openstack (lua_State *L, StkId pos) {
109 109
110static void dohook (lua_State *L, lua_Debug *ar, lua_Hook hook) { 110static void dohook (lua_State *L, lua_Debug *ar, lua_Hook hook) {
111 ptrdiff_t top = savestack(L, L->top); 111 ptrdiff_t top = savestack(L, L->top);
112 ptrdiff_t ci_top = savestack(L, L->ci->top);
112 luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ 113 luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
113 L->ci->top += LUA_MINSTACK; 114 L->ci->top = L->top + LUA_MINSTACK;
114 L->allowhooks = 0; /* cannot call hooks inside a hook */ 115 L->allowhooks = 0; /* cannot call hooks inside a hook */
115 lua_unlock(L); 116 lua_unlock(L);
116 (*hook)(L, ar); 117 (*hook)(L, ar);
117 lua_lock(L); 118 lua_lock(L);
118 lua_assert(L->allowhooks == 0); 119 lua_assert(L->allowhooks == 0);
119 L->allowhooks = 1; 120 L->allowhooks = 1;
120 L->ci->top -= LUA_MINSTACK; 121 L->ci->top = restorestack(L, ci_top);
121 L->top = restorestack(L, top); 122 L->top = restorestack(L, top);
122} 123}
123 124