diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-12-06 16:08:03 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-12-06 16:08:03 -0200 |
| commit | ae11e37e53be81f1d1eb21dde02dd26d6a21c194 (patch) | |
| tree | 51627ff35b30b13e627ce7557329915c48f703a7 | |
| parent | c7ee7fe026aa2247377bdd7915089a8e0074de1a (diff) | |
| download | lua-ae11e37e53be81f1d1eb21dde02dd26d6a21c194.tar.gz lua-ae11e37e53be81f1d1eb21dde02dd26d6a21c194.tar.bz2 lua-ae11e37e53be81f1d1eb21dde02dd26d6a21c194.zip | |
bug: 'lua_pushcclosure' should not call the GC when 'n' is zero
| -rw-r--r-- | lapi.c | 7 |
1 files changed, 4 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.276 2017/11/07 13:25:26 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.277 2017/11/23 19:29:04 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -550,6 +550,7 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { | |||
| 550 | lua_lock(L); | 550 | lua_lock(L); |
| 551 | if (n == 0) { | 551 | if (n == 0) { |
| 552 | setfvalue(s2v(L->top), fn); | 552 | setfvalue(s2v(L->top), fn); |
| 553 | api_incr_top(L); | ||
| 553 | } | 554 | } |
| 554 | else { | 555 | else { |
| 555 | CClosure *cl; | 556 | CClosure *cl; |
| @@ -563,9 +564,9 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { | |||
| 563 | /* does not need barrier because closure is white */ | 564 | /* does not need barrier because closure is white */ |
| 564 | } | 565 | } |
| 565 | setclCvalue(L, s2v(L->top), cl); | 566 | setclCvalue(L, s2v(L->top), cl); |
| 567 | api_incr_top(L); | ||
| 568 | luaC_checkGC(L); | ||
| 566 | } | 569 | } |
| 567 | api_incr_top(L); | ||
| 568 | luaC_checkGC(L); | ||
| 569 | lua_unlock(L); | 570 | lua_unlock(L); |
| 570 | } | 571 | } |
| 571 | 572 | ||
