Skip to content

Commit 9b72355

Browse files
committed
USHRT_MAX changed to SHRT_MAX
USHRT_MAX does not fit in an 'int' in 16-bit systems.
1 parent ddfa1fb commit 9b72355

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lapi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,7 @@ void lua_warning (lua_State *L, const char *msg, int tocont) {
13401340
LUA_API void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue) {
13411341
Udata *u;
13421342
lua_lock(L);
1343-
api_check(L, 0 <= nuvalue && nuvalue < USHRT_MAX, "invalid value");
1343+
api_check(L, 0 <= nuvalue && nuvalue < SHRT_MAX, "invalid value");
13441344
u = luaS_newudata(L, size, cast(unsigned short, nuvalue));
13451345
setuvalue(L, s2v(L->top.p), u);
13461346
api_incr_top(L);

lparser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static int new_localvarkind (LexState *ls, TString *name, lu_byte kind) {
199199
luaY_checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal,
200200
MAXVARS, "local variables");
201201
luaM_growvector(L, dyd->actvar.arr, dyd->actvar.n + 1,
202-
dyd->actvar.size, Vardesc, USHRT_MAX, "local variables");
202+
dyd->actvar.size, Vardesc, SHRT_MAX, "local variables");
203203
var = &dyd->actvar.arr[dyd->actvar.n++];
204204
var->vd.kind = kind; /* default */
205205
var->vd.name = name;

0 commit comments

Comments
 (0)