aboutsummaryrefslogtreecommitdiff
path: root/ldebug.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-04-23 11:55:04 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-04-23 11:55:04 -0300
commite05590591410a5e007a1e3f1691f6c1cf9d8fe45 (patch)
treecd13636363ff66a9d56f979293e353975c36b77b /ldebug.c
parent9b014d4bcd4ebadb523f1c1a1d38148d8526e5ed (diff)
downloadlua-e05590591410a5e007a1e3f1691f6c1cf9d8fe45.tar.gz
lua-e05590591410a5e007a1e3f1691f6c1cf9d8fe45.tar.bz2
lua-e05590591410a5e007a1e3f1691f6c1cf9d8fe45.zip
New macro 'pushvfstring'HEADmaster
Helps to ensure that 'luaO_pushvfstring' is being called correctly, with an error check after closing the vararg list with 'va_end'.
Diffstat (limited to 'ldebug.c')
-rw-r--r--ldebug.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/ldebug.c b/ldebug.c
index 258a4394..f4bb0a08 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -852,12 +852,8 @@ l_noret luaG_runerror (lua_State *L, const char *fmt, ...) {
852 const char *msg; 852 const char *msg;
853 va_list argp; 853 va_list argp;
854 luaC_checkGC(L); /* error message uses memory */ 854 luaC_checkGC(L); /* error message uses memory */
855 va_start(argp, fmt); 855 pushvfstring(L, argp, fmt, msg);
856 msg = luaO_pushvfstring(L, fmt, argp); /* format message */ 856 if (isLua(ci)) { /* Lua function? */
857 va_end(argp);
858 if (msg == NULL) /* no memory to format message? */
859 luaD_throw(L, LUA_ERRMEM);
860 else if (isLua(ci)) { /* Lua function? */
861 /* add source:line information */ 857 /* add source:line information */
862 luaG_addinfo(L, msg, ci_func(ci)->p->source, getcurrentline(ci)); 858 luaG_addinfo(L, msg, ci_func(ci)->p->source, getcurrentline(ci));
863 setobjs2s(L, L->top.p - 2, L->top.p - 1); /* remove 'msg' */ 859 setobjs2s(L, L->top.p - 2, L->top.p - 1); /* remove 'msg' */