aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
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 /lobject.h
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 'lobject.h')
-rw-r--r--lobject.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lobject.h b/lobject.h
index 8c06a224..b5ca3668 100644
--- a/lobject.h
+++ b/lobject.h
@@ -822,6 +822,15 @@ typedef struct Table {
822/* size of buffer for 'luaO_utf8esc' function */ 822/* size of buffer for 'luaO_utf8esc' function */
823#define UTF8BUFFSZ 8 823#define UTF8BUFFSZ 8
824 824
825
826/* macro to call 'luaO_pushvfstring' correctly */
827#define pushvfstring(L, argp, fmt, msg) \
828 { va_start(argp, fmt); \
829 msg = luaO_pushvfstring(L, fmt, argp); \
830 va_end(argp); \
831 if (msg == NULL) luaD_throw(L, LUA_ERRMEM); /* only after 'va_end' */ }
832
833
825LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x); 834LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x);
826LUAI_FUNC lu_byte luaO_ceillog2 (unsigned int x); 835LUAI_FUNC lu_byte luaO_ceillog2 (unsigned int x);
827LUAI_FUNC lu_byte luaO_codeparam (unsigned int p); 836LUAI_FUNC lu_byte luaO_codeparam (unsigned int p);