aboutsummaryrefslogtreecommitdiff
path: root/lapi.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 /lapi.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 'lapi.c')
-rw-r--r--lapi.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/lapi.c b/lapi.c
index f59430a7..769eba13 100644
--- a/lapi.c
+++ b/lapi.c
@@ -593,12 +593,8 @@ LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) {
593 const char *ret; 593 const char *ret;
594 va_list argp; 594 va_list argp;
595 lua_lock(L); 595 lua_lock(L);
596 va_start(argp, fmt); 596 pushvfstring(L, argp, fmt, ret);
597 ret = luaO_pushvfstring(L, fmt, argp);
598 va_end(argp);
599 luaC_checkGC(L); 597 luaC_checkGC(L);
600 if (ret == NULL) /* error? */
601 luaD_throw(L, LUA_ERRMEM);
602 lua_unlock(L); 598 lua_unlock(L);
603 return ret; 599 return ret;
604} 600}