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'.
This commit is contained in:
6
lcode.c
6
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 <token>" from final message */
|
||||
luaX_syntaxerror(ls, msg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user