lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 9b72355f993567facefec570fd95c8909de33393
parent ddfa1fbccfe4c1ec69f7396a4f5842abe70927ba
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Thu, 19 Sep 2024 19:05:49 -0300

USHRT_MAX changed to SHRT_MAX

USHRT_MAX does not fit in an 'int' in 16-bit systems.

Diffstat:
Mlapi.c | 2+-
Mlparser.c | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lapi.c b/lapi.c @@ -1340,7 +1340,7 @@ void lua_warning (lua_State *L, const char *msg, int tocont) { LUA_API void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue) { Udata *u; lua_lock(L); - api_check(L, 0 <= nuvalue && nuvalue < USHRT_MAX, "invalid value"); + api_check(L, 0 <= nuvalue && nuvalue < SHRT_MAX, "invalid value"); u = luaS_newudata(L, size, cast(unsigned short, nuvalue)); setuvalue(L, s2v(L->top.p), u); api_incr_top(L); diff --git a/lparser.c b/lparser.c @@ -199,7 +199,7 @@ static int new_localvarkind (LexState *ls, TString *name, lu_byte kind) { luaY_checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal, MAXVARS, "local variables"); luaM_growvector(L, dyd->actvar.arr, dyd->actvar.n + 1, - dyd->actvar.size, Vardesc, USHRT_MAX, "local variables"); + dyd->actvar.size, Vardesc, SHRT_MAX, "local variables"); var = &dyd->actvar.arr[dyd->actvar.n++]; var->vd.kind = kind; /* default */ var->vd.name = name;