diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-05 15:10:52 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-05 15:10:52 -0200 |
| commit | 56e50e8bc546884957fbe1d82ff78d27f1eef93c (patch) | |
| tree | cfdadb1464784237dee37b6294aeabbab3088f96 /lapi.c | |
| parent | 90569630d6755190c5f499c51e1d0e6ef41c6cd8 (diff) | |
| download | lua-56e50e8bc546884957fbe1d82ff78d27f1eef93c.tar.gz lua-56e50e8bc546884957fbe1d82ff78d27f1eef93c.tar.bz2 lua-56e50e8bc546884957fbe1d82ff78d27f1eef93c.zip | |
'collectgarbage' returns old mode when changing mode
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 6 |
1 files changed, 5 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.281 2018/01/28 15:13:26 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.282 2018/01/29 16:21:35 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 | */ |
| @@ -1121,6 +1121,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
| 1121 | break; | 1121 | break; |
| 1122 | } | 1122 | } |
| 1123 | case LUA_GCGEN: { | 1123 | case LUA_GCGEN: { |
| 1124 | int oldmode = g->gckind; | ||
| 1124 | int minormul = va_arg(argp, int); | 1125 | int minormul = va_arg(argp, int); |
| 1125 | int majormul = va_arg(argp, int); | 1126 | int majormul = va_arg(argp, int); |
| 1126 | if (minormul != 0) | 1127 | if (minormul != 0) |
| @@ -1128,9 +1129,11 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
| 1128 | if (majormul != 0) | 1129 | if (majormul != 0) |
| 1129 | setgcparam(g->genmajormul, majormul); | 1130 | setgcparam(g->genmajormul, majormul); |
| 1130 | luaC_changemode(L, KGC_GEN); | 1131 | luaC_changemode(L, KGC_GEN); |
| 1132 | res = (oldmode == KGC_GEN) ? LUA_GCGEN : LUA_GCINC; | ||
| 1131 | break; | 1133 | break; |
| 1132 | } | 1134 | } |
| 1133 | case LUA_GCINC: { | 1135 | case LUA_GCINC: { |
| 1136 | int oldmode = g->gckind; | ||
| 1134 | int pause = va_arg(argp, int); | 1137 | int pause = va_arg(argp, int); |
| 1135 | int stepmul = va_arg(argp, int); | 1138 | int stepmul = va_arg(argp, int); |
| 1136 | int stepsize = va_arg(argp, int); | 1139 | int stepsize = va_arg(argp, int); |
| @@ -1141,6 +1144,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
| 1141 | if (stepsize != 0) | 1144 | if (stepsize != 0) |
| 1142 | g->gcstepsize = stepsize; | 1145 | g->gcstepsize = stepsize; |
| 1143 | luaC_changemode(L, KGC_INC); | 1146 | luaC_changemode(L, KGC_INC); |
| 1147 | res = (oldmode == KGC_GEN) ? LUA_GCGEN : LUA_GCINC; | ||
| 1144 | break; | 1148 | break; |
| 1145 | } | 1149 | } |
| 1146 | default: res = -1; /* invalid option */ | 1150 | default: res = -1; /* invalid option */ |
