Parameter for lua_gc/LUA_GCSTEP changed to 'size_t'
'size_t' is the common type for measuring memory. 'int' can be too small for steps.
This commit is contained in:
2
lapi.c
2
lapi.c
@@ -1199,7 +1199,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) {
|
|||||||
}
|
}
|
||||||
case LUA_GCSTEP: {
|
case LUA_GCSTEP: {
|
||||||
lu_byte oldstp = g->gcstp;
|
lu_byte oldstp = g->gcstp;
|
||||||
l_obj n = va_arg(argp, int);
|
l_obj n = cast(l_obj, va_arg(argp, size_t));
|
||||||
int work = 0; /* true if GC did some work */
|
int work = 0; /* true if GC did some work */
|
||||||
g->gcstp = 0; /* allow GC to run (other bits must be zero here) */
|
g->gcstp = 0; /* allow GC to run (other bits must be zero here) */
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ static int luaB_collectgarbage (lua_State *L) {
|
|||||||
}
|
}
|
||||||
case LUA_GCSTEP: {
|
case LUA_GCSTEP: {
|
||||||
lua_Integer n = luaL_optinteger(L, 2, 0);
|
lua_Integer n = luaL_optinteger(L, 2, 0);
|
||||||
int res = lua_gc(L, o, (int)n);
|
int res = lua_gc(L, o, cast_sizet(n));
|
||||||
checkvalres(res);
|
checkvalres(res);
|
||||||
lua_pushboolean(L, res);
|
lua_pushboolean(L, res);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -3326,7 +3326,7 @@ Returns the remainder of dividing the current amount of bytes of
|
|||||||
memory in use by Lua by 1024.
|
memory in use by Lua by 1024.
|
||||||
}
|
}
|
||||||
|
|
||||||
@item{@defid{LUA_GCSTEP} (int n)|
|
@item{@defid{LUA_GCSTEP} (size_t n)|
|
||||||
Performs a step of garbage collection.
|
Performs a step of garbage collection.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user