diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-09-10 17:05:39 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-09-10 17:05:39 -0300 |
commit | 4901853c1163d0bba81ef1579835cb2b6560e245 (patch) | |
tree | bd2c0cbc6c70ae789c6b98d73581c65379493dbf | |
parent | a04e0ffdb9be42a77b5657f46cac8d7faa5a0f43 (diff) | |
download | lua-4901853c1163d0bba81ef1579835cb2b6560e245.tar.gz lua-4901853c1163d0bba81ef1579835cb2b6560e245.tar.bz2 lua-4901853c1163d0bba81ef1579835cb2b6560e245.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | lapi.c | 2 | ||||
-rw-r--r-- | lbaselib.c | 2 | ||||
-rw-r--r-- | manual/manual.of | 2 |
3 files changed, 3 insertions, 3 deletions
@@ -1199,7 +1199,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
1199 | } | 1199 | } |
1200 | case LUA_GCSTEP: { | 1200 | case LUA_GCSTEP: { |
1201 | lu_byte oldstp = g->gcstp; | 1201 | lu_byte oldstp = g->gcstp; |
1202 | l_obj n = va_arg(argp, int); | 1202 | l_obj n = cast(l_obj, va_arg(argp, size_t)); |
1203 | int work = 0; /* true if GC did some work */ | 1203 | int work = 0; /* true if GC did some work */ |
1204 | g->gcstp = 0; /* allow GC to run (other bits must be zero here) */ | 1204 | g->gcstp = 0; /* allow GC to run (other bits must be zero here) */ |
1205 | if (n <= 0) | 1205 | if (n <= 0) |
@@ -216,7 +216,7 @@ static int luaB_collectgarbage (lua_State *L) { | |||
216 | } | 216 | } |
217 | case LUA_GCSTEP: { | 217 | case LUA_GCSTEP: { |
218 | lua_Integer n = luaL_optinteger(L, 2, 0); | 218 | lua_Integer n = luaL_optinteger(L, 2, 0); |
219 | int res = lua_gc(L, o, (int)n); | 219 | int res = lua_gc(L, o, cast_sizet(n)); |
220 | checkvalres(res); | 220 | checkvalres(res); |
221 | lua_pushboolean(L, res); | 221 | lua_pushboolean(L, res); |
222 | return 1; | 222 | return 1; |
diff --git a/manual/manual.of b/manual/manual.of index 93e3a114..f0a2ed94 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
@@ -3326,7 +3326,7 @@ Returns the remainder of dividing the current amount of bytes of | |||
3326 | memory in use by Lua by 1024. | 3326 | memory in use by Lua by 1024. |
3327 | } | 3327 | } |
3328 | 3328 | ||
3329 | @item{@defid{LUA_GCSTEP} (int n)| | 3329 | @item{@defid{LUA_GCSTEP} (size_t n)| |
3330 | Performs a step of garbage collection. | 3330 | Performs a step of garbage collection. |
3331 | } | 3331 | } |
3332 | 3332 | ||