diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-04-23 11:55:04 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-04-23 11:55:04 -0300 |
commit | e05590591410a5e007a1e3f1691f6c1cf9d8fe45 (patch) | |
tree | cd13636363ff66a9d56f979293e353975c36b77b /lobject.h | |
parent | 9b014d4bcd4ebadb523f1c1a1d38148d8526e5ed (diff) | |
download | lua-e05590591410a5e007a1e3f1691f6c1cf9d8fe45.tar.gz lua-e05590591410a5e007a1e3f1691f6c1cf9d8fe45.tar.bz2 lua-e05590591410a5e007a1e3f1691f6c1cf9d8fe45.zip |
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.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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 | |||
825 | LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x); | 834 | LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x); |
826 | LUAI_FUNC lu_byte luaO_ceillog2 (unsigned int x); | 835 | LUAI_FUNC lu_byte luaO_ceillog2 (unsigned int x); |
827 | LUAI_FUNC lu_byte luaO_codeparam (unsigned int p); | 836 | LUAI_FUNC lu_byte luaO_codeparam (unsigned int p); |