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
lapi.c
6
lapi.c
@@ -593,12 +593,8 @@ LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) {
|
||||
const char *ret;
|
||||
va_list argp;
|
||||
lua_lock(L);
|
||||
va_start(argp, fmt);
|
||||
ret = luaO_pushvfstring(L, fmt, argp);
|
||||
va_end(argp);
|
||||
pushvfstring(L, argp, fmt, ret);
|
||||
luaC_checkGC(L);
|
||||
if (ret == NULL) /* error? */
|
||||
luaD_throw(L, LUA_ERRMEM);
|
||||
lua_unlock(L);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user