commit d8b0bbb2ada3b4ffa59888f740f9a8d7c3eef8f7 parent 1f4ee4a4d2462edbb1e0811ef1e317f4778e619d Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br> Date: Fri, 22 Nov 1996 11:08:08 -0200 BUG: pointer arithmetic does not have to work when pointing outside an array. Diffstat:
M | opcode.c | | | 10 | +++++----- |
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/opcode.c b/opcode.c @@ -3,7 +3,7 @@ ** TecCGraf - PUC-Rio */ -char *rcs_opcode="$Id: opcode.c,v 3.76 1996/09/24 21:46:44 roberto Exp roberto $"; +char *rcs_opcode="$Id: opcode.c,v 3.77 1996/11/18 13:48:44 roberto Exp roberto $"; #include <setjmp.h> #include <stdio.h> @@ -399,11 +399,11 @@ void lua_error (char *s) lua_Function lua_stackedfunction (int level) { - Object *p = top; - while (--p >= stack) - if (p->tag == LUA_T_MARK || p->tag == LUA_T_CMARK) + StkId i; + for (i = (top-1)-stack; i>=0; i--) + if (stack[i].tag == LUA_T_MARK || stack[i].tag == LUA_T_CMARK) if (level-- == 0) - return Ref(p); + return Ref(stack+i); return LUA_NOOBJECT; }