From 8e4ac679ffce4a2d59b0a404473275411854f598 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 12 Aug 2002 14:23:12 -0300 Subject: use a linear count for count hook --- ldebug.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'ldebug.c') diff --git a/ldebug.c b/ldebug.c index 40141157..d4d0eb00 100644 --- a/ldebug.c +++ b/ldebug.c @@ -1,5 +1,5 @@ /* -** $Id: ldebug.c,v 1.130 2002/08/07 19:22:39 roberto Exp roberto $ +** $Id: ldebug.c,v 1.131 2002/08/08 20:08:41 roberto Exp roberto $ ** Debug Interface ** See Copyright Notice in lua.h */ @@ -33,11 +33,8 @@ static const char *getfuncname (CallInfo *ci, const char **name); static int currentpc (CallInfo *ci) { if (!isLua(ci)) return -1; /* function is not a Lua function? */ - if (!(ci->state & CI_SAVEDPC)) { /* savedpc outdated? */ - lua_assert(ci->state & CI_HASFRAME); - ci->u.l.savedpc = *ci->u.l.pc; - ci->state |= CI_SAVEDPC; - } + if (ci->state & CI_HASFRAME) /* function has a frame? */ + ci->u.l.savedpc = *ci->u.l.pc; /* use `pc' from there */ /* function's pc is saved */ return pcRel(ci->u.l.savedpc, ci_func(ci)->l.p); } @@ -52,7 +49,7 @@ static int currentline (CallInfo *ci) { } -LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask) { +LUA_API int lua_sethook (lua_State *L, lua_Hook func, unsigned long mask) { int allow; CallInfo *ci; lua_lock(L); @@ -75,7 +72,7 @@ LUA_API lua_Hook lua_gethook (lua_State *L) { } -LUA_API int lua_gethookmask (lua_State *L) { +LUA_API unsigned long lua_gethookmask (lua_State *L) { return L->hookmask; } -- cgit v1.2.3-55-g6feb