mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
LUAI_MAXSTACK defined privately
LUAI_MAXSTACK is limited to INT_MAX/2, so can use INT_MAX/2 to define pseudo-indices (LUA_REGISTRYINDEX) in 'lua.h'. A change in the maximum stack size does not need to change the Lua-C ABI.
This commit is contained in:
parent
cfce6f4b20
commit
59a1adf194
4 changed files with 17 additions and 18 deletions
6
lua.h
6
lua.h
|
|
@ -37,10 +37,10 @@
|
|||
|
||||
/*
|
||||
** Pseudo-indices
|
||||
** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty
|
||||
** space after that to help overflow detection)
|
||||
** (The stack size is limited to INT_MAX/2; we keep some free empty
|
||||
** space after that to help overflow detection.)
|
||||
*/
|
||||
#define LUA_REGISTRYINDEX (-LUAI_MAXSTACK - 1000)
|
||||
#define LUA_REGISTRYINDEX (-(INT_MAX/2 + 1000))
|
||||
#define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue