From d8b0bbb2ada3b4ffa59888f740f9a8d7c3eef8f7 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 22 Nov 1996 11:08:28 -0200 Subject: BUG: pointer arithmetic does not have to work when pointing outside an array. --- opcode.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/opcode.c b/opcode.c index 107024a4..0df045a0 100644 --- 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 #include @@ -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; } -- cgit v1.2.3-55-g6feb