From e05590591410a5e007a1e3f1691f6c1cf9d8fe45 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 23 Apr 2025 11:55:04 -0300 Subject: New macro 'pushvfstring' Helps to ensure that 'luaO_pushvfstring' is being called correctly, with an error check after closing the vararg list with 'va_end'. --- lcode.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'lcode.c') diff --git a/lcode.c b/lcode.c index d22a081a..e8b9bb5d 100644 --- a/lcode.c +++ b/lcode.c @@ -43,11 +43,7 @@ static int codesJ (FuncState *fs, OpCode o, int sj, int k); l_noret luaK_semerror (LexState *ls, const char *fmt, ...) { const char *msg; va_list argp; - va_start(argp, fmt); - msg = luaO_pushvfstring(ls->L, fmt, argp); - va_end(argp); - if (msg == NULL) /* error? */ - luaD_throw(ls->L, LUA_ERRMEM); + pushvfstring(ls->L, argp, fmt, msg); ls->t.token = 0; /* remove "near " from final message */ luaX_syntaxerror(ls, msg); } -- cgit v1.2.3-55-g6feb