diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
commit | 8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch) | |
tree | 7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /dev-lang/lua/files/5.2.0/01_all_memory_hoarding.upstream.patch | |
parent | 30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff) |
gentoo resync : 14.07.2018
Diffstat (limited to 'dev-lang/lua/files/5.2.0/01_all_memory_hoarding.upstream.patch')
-rw-r--r-- | dev-lang/lua/files/5.2.0/01_all_memory_hoarding.upstream.patch | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/dev-lang/lua/files/5.2.0/01_all_memory_hoarding.upstream.patch b/dev-lang/lua/files/5.2.0/01_all_memory_hoarding.upstream.patch new file mode 100644 index 000000000000..9fda24ad6609 --- /dev/null +++ b/dev-lang/lua/files/5.2.0/01_all_memory_hoarding.upstream.patch @@ -0,0 +1,49 @@ +--- lua-5.2.0.orig/src/ldblib.c 2007/12/28 15:32:23 2.25.1.3 ++++ lua-5.2.0/src/ldblib.c 2009/06/15 14:07:34 +@@ -253,14 +253,15 @@ + } + + +-#define gethooktable(L) luaL_getsubtable(L, LUA_REGISTRYINDEX, HOOKKEY); ++#define gethooktable(L) luaL_getsubtable(L, LUA_REGISTRYINDEX, HOOKKEY) + + + static void hookf (lua_State *L, lua_Debug *ar) { + static const char *const hooknames[] = + {"call", "return", "line", "count", "tail call"}; + gethooktable(L); +- lua_rawgetp(L, -1, L); ++ lua_pushthread(L); ++ lua_rawget(L, -2); + if (lua_isfunction(L, -1)) { + lua_pushstring(L, hooknames[(int)ar->event]); + if (ar->currentline >= 0) +@@ -306,10 +307,15 @@ + count = luaL_optint(L, arg+3, 0); + func = hookf; mask = makemask(smask, count); + } +- gethooktable(L); ++ if (gethooktable(L) == 0) { /* creating hook table? */ ++ lua_pushstring(L, "k"); ++ lua_setfield(L, -2, "__mode"); /** hooktable.__mode = "k" */ ++ lua_pushvalue(L, -1); ++ lua_setmetatable(L, -2); /* setmetatable(hooktable) = hooktable */ ++ } ++ lua_pushthread(L1); lua_xmove(L1, L, 1); + lua_pushvalue(L, arg+1); +- lua_rawsetp(L, -2, L1); /* set new hook */ +- lua_pop(L, 1); /* remove hook table */ ++ lua_rawset(L, -3); /* set new hook */ + lua_sethook(L1, func, mask, count); /* set hooks */ + return 0; + } +@@ -325,7 +331,8 @@ + lua_pushliteral(L, "external hook"); + else { + gethooktable(L); +- lua_rawgetp(L, -1, L1); /* get hook */ ++ lua_pushthread(L1); lua_xmove(L1, L, 1); ++ lua_rawget(L, -2); /* get hook */ + lua_remove(L, -2); /* remove hook table */ + } + lua_pushstring(L, unmakemask(mask, buff)); |