diff options
| author | vadim-xd <[email protected]> | 2025-05-11 23:11:53 +0300 |
|---|---|---|
| committer | vadim-xd <[email protected]> | 2025-05-11 23:27:21 +0300 |
| commit | d94630d2ef412433360d582e7d941ff9aa96d2e8 (patch) | |
| tree | b4fce6556b8ce7d6c7abad8a769e542fac6fb2df | |
| parent | 26d7514b035a86c73cbf37d0b2f7d069027d3605 (diff) | |
Enable lua_assert in debug builds
commit_hash:ea00901b57ccbf77add24fe9e28634acf1ba557c
| -rw-r--r-- | contrib/libs/lua/lua-5.2.0/src/luaconf.h | 3 | ||||
| -rw-r--r-- | library/cpp/lua/wrapper.h | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/contrib/libs/lua/lua-5.2.0/src/luaconf.h b/contrib/libs/lua/lua-5.2.0/src/luaconf.h index fe98edbed64..e319035d2ff 100644 --- a/contrib/libs/lua/lua-5.2.0/src/luaconf.h +++ b/contrib/libs/lua/lua-5.2.0/src/luaconf.h @@ -546,7 +546,8 @@ ** without modifying the main part of the file. */ - +#include <assert.h> +#define lua_assert(c) assert(c) #endif diff --git a/library/cpp/lua/wrapper.h b/library/cpp/lua/wrapper.h index 0d568f049ad..97280b9f0d5 100644 --- a/library/cpp/lua/wrapper.h +++ b/library/cpp/lua/wrapper.h @@ -396,6 +396,10 @@ public: } inline void call(int args, int rets) { + Y_ASSUME(args >= 0); // Allows to optimize out comparison with LUA_MULTRET if it's negative (-1 in Lua 5.2-5.4) + if (rets != LUA_MULTRET && rets > args) { + ensure_stack(rets - args); + } if (lua_pcall(State_, args, rets, 0)) { error(); } |
