diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ldblib.c | 12 | ||||
-rw-r--r-- | src/loslib.c | 3 | ||||
-rw-r--r-- | src/luaconf.h | 4 | ||||
-rw-r--r-- | src/lundump.c | 6 |
4 files changed, 14 insertions, 11 deletions
diff --git a/src/ldblib.c b/src/ldblib.c index bb47cc72..8d631e37 100644 --- a/src/ldblib.c +++ b/src/ldblib.c @@ -1,5 +1,5 @@ /* -** $Id: ldblib.c,v 1.104.1.1 2007/12/27 13:02:25 roberto Exp $ +** $Id: ldblib.c,v 1.104.1.2 2008/01/18 16:39:45 roberto Exp $ ** Interface from Lua to its debug API ** See Copyright Notice in lua.h */ @@ -255,17 +255,18 @@ static void gethooktable (lua_State *L) { static int db_sethook (lua_State *L) { - int arg; + int arg, mask, count; + lua_Hook func; lua_State *L1 = getthread(L, &arg); if (lua_isnoneornil(L, arg+1)) { lua_settop(L, arg+1); - lua_sethook(L1, NULL, 0, 0); /* turn off hooks */ + func = NULL; mask = 0; count = 0; /* turn off hooks */ } else { const char *smask = luaL_checkstring(L, arg+2); - int count = luaL_optint(L, arg+3, 0); luaL_checktype(L, arg+1, LUA_TFUNCTION); - lua_sethook(L1, hookf, makemask(smask, count), count); + count = luaL_optint(L, arg+3, 0); + func = hookf; mask = makemask(smask, count); } gethooktable(L1); lua_pushlightuserdata(L1, L1); @@ -273,6 +274,7 @@ static int db_sethook (lua_State *L) { lua_xmove(L, L1, 1); lua_rawset(L1, -3); /* set new hook */ lua_pop(L1, 1); /* remove hook table */ + lua_sethook(L1, func, mask, count); /* set hooks */ return 0; } diff --git a/src/loslib.c b/src/loslib.c index be6e4e80..da06a572 100644 --- a/src/loslib.c +++ b/src/loslib.c @@ -1,5 +1,5 @@ /* -** $Id: loslib.c,v 1.19.1.2 2007/12/28 14:58:43 roberto Exp $ +** $Id: loslib.c,v 1.19.1.3 2008/01/18 16:38:18 roberto Exp $ ** Standard Operating System library ** See Copyright Notice in lua.h */ @@ -215,7 +215,6 @@ static int os_setlocale (lua_State *L) { static int os_exit (lua_State *L) { exit(luaL_optint(L, 1, EXIT_SUCCESS)); - return 0; /* to avoid warnings */ } static const luaL_Reg syslib[] = { diff --git a/src/luaconf.h b/src/luaconf.h index c9698b0d..eb2f5a1f 100644 --- a/src/luaconf.h +++ b/src/luaconf.h @@ -1,5 +1,5 @@ /* -** $Id: luaconf.h,v 1.82.1.5 2008/01/17 14:04:20 roberto Exp $ +** $Id: luaconf.h,v 1.82.1.6 2008/01/18 17:07:48 roberto Exp $ ** Configuration file for Lua ** See Copyright Notice in lua.h */ @@ -667,7 +667,7 @@ union luai_Cast { double l_d; long l_l; }; */ #if defined(LUA_USE_POPEN) -#define lua_popen(L,c,m) ((void)L, popen(c,m)) +#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) #define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) #elif defined(LUA_WIN) diff --git a/src/lundump.c b/src/lundump.c index 1f992f24..731c0645 100644 --- a/src/lundump.c +++ b/src/lundump.c @@ -1,5 +1,5 @@ /* -** $Id: lundump.c,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $ +** $Id: lundump.c,v 2.7.1.2 2008/01/18 16:39:11 roberto Exp $ ** load precompiled Lua chunks ** See Copyright Notice in lua.h */ @@ -29,6 +29,7 @@ typedef struct { #ifdef LUAC_TRUST_BINARIES #define IF(c,s) +#define error(S,s) #else #define IF(c,s) if (c) error(S,s) @@ -47,6 +48,7 @@ static void error(LoadState* S, const char* why) static void LoadBlock(LoadState* S, void* b, size_t size) { size_t r=luaZ_read(S->Z,b,size); + UNUSED(r); IF (r!=0, "unexpected end"); } @@ -122,7 +124,7 @@ static void LoadConstants(LoadState* S, Proto* f) setsvalue2n(S->L,o,LoadString(S)); break; default: - IF (1, "bad constant"); + error(S,"bad constant"); break; } } |