diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-07-01 10:57:02 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-07-01 10:57:02 -0300 |
| commit | 59a1adf194efe43741c2bb2005d93d8320a19d14 (patch) | |
| tree | 4b65f62e0b6fa8701608c776b27b65e283dc9d0b /lua.h | |
| parent | cfce6f4b20afe85ede2182b3df3ab2bfcdb0e692 (diff) | |
| download | lua-59a1adf194efe43741c2bb2005d93d8320a19d14.tar.gz lua-59a1adf194efe43741c2bb2005d93d8320a19d14.tar.bz2 lua-59a1adf194efe43741c2bb2005d93d8320a19d14.zip | |
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.
Diffstat (limited to '')
| -rw-r--r-- | lua.h | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -37,10 +37,10 @@ | |||
| 37 | 37 | ||
| 38 | /* | 38 | /* |
| 39 | ** Pseudo-indices | 39 | ** Pseudo-indices |
| 40 | ** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty | 40 | ** (The stack size is limited to INT_MAX/2; we keep some free empty |
| 41 | ** space after that to help overflow detection) | 41 | ** space after that to help overflow detection.) |
| 42 | */ | 42 | */ |
| 43 | #define LUA_REGISTRYINDEX (-LUAI_MAXSTACK - 1000) | 43 | #define LUA_REGISTRYINDEX (-(INT_MAX/2 + 1000)) |
| 44 | #define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) | 44 | #define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) |
| 45 | 45 | ||
| 46 | 46 | ||
