xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit dab89cdaf1aa3a3ba28911a77ae6e70be9b4b631

Upgrade Lua from 5.4.7 to 5.4.8.
Author: xaizek
Author date (UTC): 2025-07-01 12:33
Committer name: xaizek
Committer date (UTC): 2025-07-01 12:33
Parent(s): c6c14bc172b97a9d34d9535c240e70102c270675
Signing key: 99DC5E4DB05F6BE2
Tree: a1b315a0afc09f6dd1973defa8c751a52f67d9d8
File Lines added Lines deleted
ChangeLog.LuaAPI 4 0
src/lua/lua/lapi.c 1 1
src/lua/lua/lcode.c 2 1
src/lua/lua/ldebug.c 15 6
src/lua/lua/ldo.c 12 5
src/lua/lua/ldo.h 1 0
src/lua/lua/lparser.c 3 4
src/lua/lua/lstate.c 4 1
src/lua/lua/lua.h 4 4
src/lua/lua/lvm.c 3 0
File ChangeLog.LuaAPI changed (mode: 100644) (index 9be621a5e..aff6a8ca6)
... ... while stabilizing for v1.0 a bunch of breaking changes can happen at once. API
5 5 sections marked {deprecated} will be removed. After that all changes will be sections marked {deprecated} will be removed. After that all changes will be
6 6 documented in the regular ChangeLog. documented in the regular ChangeLog.
7 7
8 0.14 to current
9
10 Upgraded Lua from 5.4.7 to 5.4.8.
11
8 12 0.13 to 0.14-beta (2025-01-19) 0.13 to 0.14-beta (2025-01-19)
9 13
10 14 Bumped API version to v0.2.0. Bumped API version to v0.2.0.
File src/lua/lua/lapi.c changed (mode: 100644) (index d28f3a9f0..caf9a240e)
... ... void lua_warning (lua_State *L, const char *msg, int tocont) {
1343 1343 LUA_API void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue) { LUA_API void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue) {
1344 1344 Udata *u; Udata *u;
1345 1345 lua_lock(L); lua_lock(L);
1346 api_check(L, 0 <= nuvalue && nuvalue < USHRT_MAX, "invalid value");
1346 api_check(L, 0 <= nuvalue && nuvalue < SHRT_MAX, "invalid value");
1347 1347 u = luaS_newudata(L, size, nuvalue); u = luaS_newudata(L, size, nuvalue);
1348 1348 setuvalue(L, s2v(L->top.p), u); setuvalue(L, s2v(L->top.p), u);
1349 1349 api_incr_top(L); api_incr_top(L);
File src/lua/lua/lcode.c changed (mode: 100644) (index 87616140e..3f78370c6)
35 35 #define MAXREGS 255 #define MAXREGS 255
36 36
37 37
38 /* (note that expressions VJMP also have jumps.) */
38 39 #define hasjumps(e) ((e)->t != (e)->f) #define hasjumps(e) ((e)->t != (e)->f)
39 40
40 41
 
... ... void luaK_exp2anyregup (FuncState *fs, expdesc *e) {
985 986 ** or it is a constant. ** or it is a constant.
986 987 */ */
987 988 void luaK_exp2val (FuncState *fs, expdesc *e) { void luaK_exp2val (FuncState *fs, expdesc *e) {
988 if (hasjumps(e))
989 if (e->k == VJMP || hasjumps(e))
989 990 luaK_exp2anyreg(fs, e); luaK_exp2anyreg(fs, e);
990 991 else else
991 992 luaK_dischargevars(fs, e); luaK_dischargevars(fs, e);
File src/lua/lua/ldebug.c changed (mode: 100644) (index 2aa03e2d0..4bfa53931)
37 37 static const char *funcnamefromcall (lua_State *L, CallInfo *ci, static const char *funcnamefromcall (lua_State *L, CallInfo *ci,
38 38 const char **name); const char **name);
39 39
40 static const char strlocal[] = "local";
41 static const char strupval[] = "upvalue";
42
40 43
41 44 static int currentpc (CallInfo *ci) { static int currentpc (CallInfo *ci) {
42 45 lua_assert(isLua(ci)); lua_assert(isLua(ci));
 
... ... static const char *basicgetobjname (const Proto *p, int *ppc, int reg,
497 500 int pc = *ppc; int pc = *ppc;
498 501 *name = luaF_getlocalname(p, reg + 1, pc); *name = luaF_getlocalname(p, reg + 1, pc);
499 502 if (*name) /* is a local? */ if (*name) /* is a local? */
500 return "local";
503 return strlocal;
501 504 /* else try symbolic execution */ /* else try symbolic execution */
502 505 *ppc = pc = findsetreg(p, pc, reg); *ppc = pc = findsetreg(p, pc, reg);
503 506 if (pc != -1) { /* could find instruction? */ if (pc != -1) { /* could find instruction? */
 
... ... static const char *basicgetobjname (const Proto *p, int *ppc, int reg,
512 515 } }
513 516 case OP_GETUPVAL: { case OP_GETUPVAL: {
514 517 *name = upvalname(p, GETARG_B(i)); *name = upvalname(p, GETARG_B(i));
515 return "upvalue";
518 return strupval;
516 519 } }
517 520 case OP_LOADK: return kname(p, GETARG_Bx(i), name); case OP_LOADK: return kname(p, GETARG_Bx(i), name);
518 521 case OP_LOADKX: return kname(p, GETARG_Ax(p->code[pc + 1]), name); case OP_LOADKX: return kname(p, GETARG_Ax(p->code[pc + 1]), name);
 
... ... static void rkname (const Proto *p, int pc, Instruction i, const char **name) {
547 550
548 551 /* /*
549 552 ** Check whether table being indexed by instruction 'i' is the ** Check whether table being indexed by instruction 'i' is the
550 ** environment '_ENV'
553 ** environment '_ENV'. If the table is an upvalue, get its name;
554 ** otherwise, find some "name" for the table and check whether
555 ** that name is the name of a local variable (and not, for instance,
556 ** a string). Then check that, if there is a name, it is '_ENV'.
551 557 */ */
552 558 static const char *isEnv (const Proto *p, int pc, Instruction i, int isup) { static const char *isEnv (const Proto *p, int pc, Instruction i, int isup) {
553 559 int t = GETARG_B(i); /* table index */ int t = GETARG_B(i); /* table index */
554 560 const char *name; /* name of indexed variable */ const char *name; /* name of indexed variable */
555 561 if (isup) /* is 't' an upvalue? */ if (isup) /* is 't' an upvalue? */
556 562 name = upvalname(p, t); name = upvalname(p, t);
557 else /* 't' is a register */
558 basicgetobjname(p, &pc, t, &name);
563 else { /* 't' is a register */
564 const char *what = basicgetobjname(p, &pc, t, &name);
565 if (what != strlocal && what != strupval)
566 name = NULL; /* cannot be the variable _ENV */
567 }
559 568 return (name && strcmp(name, LUA_ENV) == 0) ? "global" : "field"; return (name && strcmp(name, LUA_ENV) == 0) ? "global" : "field";
560 569 } }
561 570
 
... ... static const char *getupvalname (CallInfo *ci, const TValue *o,
701 710 for (i = 0; i < c->nupvalues; i++) { for (i = 0; i < c->nupvalues; i++) {
702 711 if (c->upvals[i]->v.p == o) { if (c->upvals[i]->v.p == o) {
703 712 *name = upvalname(c->p, i); *name = upvalname(c->p, i);
704 return "upvalue";
713 return strupval;
705 714 } }
706 715 } }
707 716 return NULL; return NULL;
File src/lua/lua/ldo.c changed (mode: 100644) (index 9e733017c..fc48206df)
... ... void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) {
94 94 setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */ setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */
95 95 break; break;
96 96 } }
97 case LUA_ERRERR: {
98 setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling"));
99 break;
100 }
101 97 case LUA_OK: { /* special case only for closing upvalues */ case LUA_OK: { /* special case only for closing upvalues */
102 98 setnilvalue(s2v(oldtop)); /* no error message */ setnilvalue(s2v(oldtop)); /* no error message */
103 99 break; break;
 
... ... l_noret luaD_throw (lua_State *L, int errcode) {
120 116 else { /* thread has no error handler */ else { /* thread has no error handler */
121 117 global_State *g = G(L); global_State *g = G(L);
122 118 errcode = luaE_resetthread(L, errcode); /* close all upvalues */ errcode = luaE_resetthread(L, errcode); /* close all upvalues */
119 L->status = errcode;
123 120 if (g->mainthread->errorJmp) { /* main thread has a handler? */ if (g->mainthread->errorJmp) { /* main thread has a handler? */
124 121 setobjs2s(L, g->mainthread->top.p++, L->top.p - 1); /* copy error obj. */ setobjs2s(L, g->mainthread->top.p++, L->top.p - 1); /* copy error obj. */
125 122 luaD_throw(g->mainthread, errcode); /* re-throw in main thread */ luaD_throw(g->mainthread, errcode); /* re-throw in main thread */
 
... ... static void correctstack (lua_State *L) {
198 195 /* some space for error handling */ /* some space for error handling */
199 196 #define ERRORSTACKSIZE (LUAI_MAXSTACK + 200) #define ERRORSTACKSIZE (LUAI_MAXSTACK + 200)
200 197
198
199 /* raise an error while running the message handler */
200 l_noret luaD_errerr (lua_State *L) {
201 TString *msg = luaS_newliteral(L, "error in error handling");
202 setsvalue2s(L, L->top.p, msg);
203 L->top.p++; /* assume EXTRA_STACK */
204 luaD_throw(L, LUA_ERRERR);
205 }
206
207
201 208 /* /*
202 209 ** Reallocate the stack to a new size, correcting all pointers into it. ** Reallocate the stack to a new size, correcting all pointers into it.
203 210 ** In ISO C, any pointer use after the pointer has been deallocated is ** In ISO C, any pointer use after the pointer has been deallocated is
 
... ... int luaD_growstack (lua_State *L, int n, int raiseerror) {
247 254 a stack error; cannot grow further than that. */ a stack error; cannot grow further than that. */
248 255 lua_assert(stacksize(L) == ERRORSTACKSIZE); lua_assert(stacksize(L) == ERRORSTACKSIZE);
249 256 if (raiseerror) if (raiseerror)
250 luaD_throw(L, LUA_ERRERR); /* error inside message handler */
257 luaD_errerr(L); /* error inside message handler */
251 258 return 0; /* if not 'raiseerror', just signal it */ return 0; /* if not 'raiseerror', just signal it */
252 259 } }
253 260 else if (n < LUAI_MAXSTACK) { /* avoids arithmetic overflows */ else if (n < LUAI_MAXSTACK) { /* avoids arithmetic overflows */
File src/lua/lua/ldo.h changed (mode: 100644) (index 787a2898a..3a454729d)
60 60 /* type of protected functions, to be ran by 'runprotected' */ /* type of protected functions, to be ran by 'runprotected' */
61 61 typedef void (*Pfunc) (lua_State *L, void *ud); typedef void (*Pfunc) (lua_State *L, void *ud);
62 62
63 LUAI_FUNC l_noret luaD_errerr (lua_State *L);
63 64 LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
64 65 LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name,
65 66 const char *mode); const char *mode);
File src/lua/lua/lparser.c changed (mode: 100644) (index 4cb6567db..0c7f27445)
... ... static int new_localvar (LexState *ls, TString *name) {
198 198 checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal, checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal,
199 199 MAXVARS, "local variables"); MAXVARS, "local variables");
200 200 luaM_growvector(L, dyd->actvar.arr, dyd->actvar.n + 1, luaM_growvector(L, dyd->actvar.arr, dyd->actvar.n + 1,
201 dyd->actvar.size, Vardesc, USHRT_MAX, "local variables");
201 dyd->actvar.size, Vardesc, SHRT_MAX, "local variables");
202 202 var = &dyd->actvar.arr[dyd->actvar.n++]; var = &dyd->actvar.arr[dyd->actvar.n++];
203 203 var->vd.kind = VDKREG; /* default */ var->vd.kind = VDKREG; /* default */
204 204 var->vd.name = name; var->vd.name = name;
 
... ... static void recfield (LexState *ls, ConsControl *cc) {
849 849 FuncState *fs = ls->fs; FuncState *fs = ls->fs;
850 850 int reg = ls->fs->freereg; int reg = ls->fs->freereg;
851 851 expdesc tab, key, val; expdesc tab, key, val;
852 if (ls->t.token == TK_NAME) {
853 checklimit(fs, cc->nh, MAX_INT, "items in a constructor");
852 if (ls->t.token == TK_NAME)
854 853 codename(ls, &key); codename(ls, &key);
855 }
856 854 else /* ls->t.token == '[' */ else /* ls->t.token == '[' */
857 855 yindex(ls, &key); yindex(ls, &key);
856 checklimit(fs, cc->nh, MAX_INT, "items in a constructor");
858 857 cc->nh++; cc->nh++;
859 858 checknext(ls, '='); checknext(ls, '=');
860 859 tab = *cc->t; tab = *cc->t;
File src/lua/lua/lstate.c changed (mode: 100644) (index bb9a30ea4..3a2e77e74)
... ... void luaE_checkcstack (lua_State *L) {
166 166 if (getCcalls(L) == LUAI_MAXCCALLS) if (getCcalls(L) == LUAI_MAXCCALLS)
167 167 luaG_runerror(L, "C stack overflow"); luaG_runerror(L, "C stack overflow");
168 168 else if (getCcalls(L) >= (LUAI_MAXCCALLS / 10 * 11)) else if (getCcalls(L) >= (LUAI_MAXCCALLS / 10 * 11))
169 luaD_throw(L, LUA_ERRERR); /* error while handling stack error */
169 luaD_errerr(L); /* error while handling stack error */
170 170 } }
171 171
172 172
 
... ... static void close_state (lua_State *L) {
272 272 luaC_freeallobjects(L); /* just collect its objects */ luaC_freeallobjects(L); /* just collect its objects */
273 273 else { /* closing a fully built state */ else { /* closing a fully built state */
274 274 L->ci = &L->base_ci; /* unwind CallInfo list */ L->ci = &L->base_ci; /* unwind CallInfo list */
275 L->errfunc = 0; /* stack unwind can "throw away" the error function */
275 276 luaD_closeprotected(L, 1, LUA_OK); /* close all upvalues */ luaD_closeprotected(L, 1, LUA_OK); /* close all upvalues */
277 L->top.p = L->stack.p + 1; /* empty the stack to run finalizers */
276 278 luaC_freeallobjects(L); /* collect all objects */ luaC_freeallobjects(L); /* collect all objects */
277 279 luai_userstateclose(L); luai_userstateclose(L);
278 280 } }
 
... ... int luaE_resetthread (lua_State *L, int status) {
328 330 if (status == LUA_YIELD) if (status == LUA_YIELD)
329 331 status = LUA_OK; status = LUA_OK;
330 332 L->status = LUA_OK; /* so it can run __close metamethods */ L->status = LUA_OK; /* so it can run __close metamethods */
333 L->errfunc = 0; /* stack unwind can "throw away" the error function */
331 334 status = luaD_closeprotected(L, 1, status); status = luaD_closeprotected(L, 1, status);
332 335 if (status != LUA_OK) /* errors? */ if (status != LUA_OK) /* errors? */
333 336 luaD_seterrorobj(L, status, L->stack.p + 1); luaD_seterrorobj(L, status, L->stack.p + 1);
File src/lua/lua/lua.h changed (mode: 100644) (index f050dac09..f3ea590d9)
18 18
19 19 #define LUA_VERSION_MAJOR "5" #define LUA_VERSION_MAJOR "5"
20 20 #define LUA_VERSION_MINOR "4" #define LUA_VERSION_MINOR "4"
21 #define LUA_VERSION_RELEASE "7"
21 #define LUA_VERSION_RELEASE "8"
22 22
23 23 #define LUA_VERSION_NUM 504 #define LUA_VERSION_NUM 504
24 #define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 7)
24 #define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 8)
25 25
26 26 #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
27 27 #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
28 #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2024 Lua.org, PUC-Rio"
28 #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2025 Lua.org, PUC-Rio"
29 29 #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
30 30
31 31
 
... ... struct lua_Debug {
497 497
498 498
499 499 /****************************************************************************** /******************************************************************************
500 * Copyright (C) 1994-2024 Lua.org, PUC-Rio.
500 * Copyright (C) 1994-2025 Lua.org, PUC-Rio.
501 501 * *
502 502 * Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
503 503 * a copy of this software and associated documentation files (the * a copy of this software and associated documentation files (the
File src/lua/lua/lvm.c changed (mode: 100644) (index fcd24e11d..7023a04da)
... ... void luaV_finishset (lua_State *L, const TValue *t, TValue *key,
339 339 lua_assert(isempty(slot)); /* slot must be empty */ lua_assert(isempty(slot)); /* slot must be empty */
340 340 tm = fasttm(L, h->metatable, TM_NEWINDEX); /* get metamethod */ tm = fasttm(L, h->metatable, TM_NEWINDEX); /* get metamethod */
341 341 if (tm == NULL) { /* no metamethod? */ if (tm == NULL) { /* no metamethod? */
342 sethvalue2s(L, L->top.p, h); /* anchor 't' */
343 L->top.p++; /* assume EXTRA_STACK */
342 344 luaH_finishset(L, h, key, slot, val); /* set new value */ luaH_finishset(L, h, key, slot, val); /* set new value */
345 L->top.p--;
343 346 invalidateTMcache(h); invalidateTMcache(h);
344 347 luaC_barrierback(L, obj2gco(h), val); luaC_barrierback(L, obj2gco(h), val);
345 348 return; return;
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master