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:
8
ldebug.c
8
ldebug.c
@@ -852,12 +852,8 @@ l_noret luaG_runerror (lua_State *L, const char *fmt, ...) {
|
||||
const char *msg;
|
||||
va_list argp;
|
||||
luaC_checkGC(L); /* error message uses memory */
|
||||
va_start(argp, fmt);
|
||||
msg = luaO_pushvfstring(L, fmt, argp); /* format message */
|
||||
va_end(argp);
|
||||
if (msg == NULL) /* no memory to format message? */
|
||||
luaD_throw(L, LUA_ERRMEM);
|
||||
else if (isLua(ci)) { /* Lua function? */
|
||||
pushvfstring(L, argp, fmt, msg);
|
||||
if (isLua(ci)) { /* Lua function? */
|
||||
/* add source:line information */
|
||||
luaG_addinfo(L, msg, ci_func(ci)->p->source, getcurrentline(ci));
|
||||
setobjs2s(L, L->top.p - 2, L->top.p - 1); /* remove 'msg' */
|
||||
|
||||
Reference in New Issue
Block a user