Skip to content

Commit f3df462

Browse files
committed
Update Lua 5.3 to 5.3.6 and bump version to 540.0.1
1 parent 9ae371d commit f3df462

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+62
-41
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lua-src"
3-
version = "540.0.0"
3+
version = "540.0.1"
44
authors = ["Aleksandr Orlenko <[email protected]>"]
55
edition = "2018"
66
repository = "https://github.com/khvzak/lua-src-rs"

lua-5.3.5/lapi.c renamed to lua-5.3.6/lapi.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,13 +1254,12 @@ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {
12541254
}
12551255

12561256

1257-
static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) {
1257+
static UpVal **getupvalref (lua_State *L, int fidx, int n) {
12581258
LClosure *f;
12591259
StkId fi = index2addr(L, fidx);
12601260
api_check(L, ttisLclosure(fi), "Lua function expected");
12611261
f = clLvalue(fi);
12621262
api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index");
1263-
if (pf) *pf = f;
12641263
return &f->upvals[n - 1]; /* get its upvalue pointer */
12651264
}
12661265

@@ -1269,7 +1268,7 @@ LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) {
12691268
StkId fi = index2addr(L, fidx);
12701269
switch (ttype(fi)) {
12711270
case LUA_TLCL: { /* lua closure */
1272-
return *getupvalref(L, fidx, n, NULL);
1271+
return *getupvalref(L, fidx, n);
12731272
}
12741273
case LUA_TCCL: { /* C closure */
12751274
CClosure *f = clCvalue(fi);
@@ -1286,9 +1285,10 @@ LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) {
12861285

12871286
LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1,
12881287
int fidx2, int n2) {
1289-
LClosure *f1;
1290-
UpVal **up1 = getupvalref(L, fidx1, n1, &f1);
1291-
UpVal **up2 = getupvalref(L, fidx2, n2, NULL);
1288+
UpVal **up1 = getupvalref(L, fidx1, n1);
1289+
UpVal **up2 = getupvalref(L, fidx2, n2);
1290+
if (*up1 == *up2)
1291+
return;
12921292
luaC_upvdeccount(L, *up1);
12931293
*up1 = *up2;
12941294
(*up1)->refcount++;
File renamed without changes.

lua-5.3.5/lauxlib.c renamed to lua-5.3.6/lauxlib.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,8 +1011,13 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
10111011
free(ptr);
10121012
return NULL;
10131013
}
1014-
else
1015-
return realloc(ptr, nsize);
1014+
else { /* cannot fail when shrinking a block */
1015+
void *newptr = realloc(ptr, nsize);
1016+
if (newptr == NULL && ptr != NULL && nsize <= osize)
1017+
return ptr; /* keep the original block */
1018+
else /* no fail or not shrinking */
1019+
return newptr; /* use the new block */
1020+
}
10161021
}
10171022

10181023

File renamed without changes.
File renamed without changes.
File renamed without changes.

lua-5.3.5/lcode.c renamed to lua-5.3.6/lcode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ static void codecomp (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) {
10611061

10621062

10631063
/*
1064-
** Aplly prefix operation 'op' to expression 'e'.
1064+
** Apply prefix operation 'op' to expression 'e'.
10651065
*/
10661066
void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) {
10671067
static const expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP};
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)