summaryrefslogtreecommitdiff
path: root/external/mit/lua
diff options
context:
space:
mode:
authormbalmer <mbalmer@NetBSD.org>2017-12-13 13:00:14 +0000
committermbalmer <mbalmer@NetBSD.org>2017-12-13 13:00:14 +0000
commit11d98bfbaf671d9e2a334f7cd7b69843e95395d5 (patch)
treefb79873b501b83413d2d51359e83c49b628ab2e7 /external/mit/lua
parent7971018cca740fda8da8134bec82c23b598b4934 (diff)
Apply a bugfix from lua.org/bugs,html:
lua_pushcclosure should not call the garbage collector when n is zero.
Diffstat (limited to 'external/mit/lua')
-rw-r--r--external/mit/lua/dist/src/lapi.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/external/mit/lua/dist/src/lapi.c b/external/mit/lua/dist/src/lapi.c
index 6884ec50e3e..619c5ecd5fe 100644
--- a/external/mit/lua/dist/src/lapi.c
+++ b/external/mit/lua/dist/src/lapi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lapi.c,v 1.9 2017/04/26 13:17:33 mbalmer Exp $ */
+/* $NetBSD: lapi.c,v 1.10 2017/12/13 13:00:14 mbalmer Exp $ */
/*
** Id: lapi.c,v 2.259 2016/02/29 14:27:14 roberto Exp
@@ -541,6 +541,7 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
lua_lock(L);
if (n == 0) {
setfvalue(L->top, fn);
+ api_incr_top(L);
}
else {
CClosure *cl;
@@ -554,9 +555,9 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
/* does not need barrier because closure is white */
}
setclCvalue(L, L->top, cl);
+ api_incr_top(L);
+ luaC_checkGC(L);
}
- api_incr_top(L);
- luaC_checkGC(L);
lua_unlock(L);
}