diff options
| -rw-r--r-- | luaconf.h | 22 |
1 files changed, 15 insertions, 7 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: luaconf.h,v 1.94 2008/01/02 16:36:19 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.95 2008/01/17 16:24:38 roberto Exp roberto $ |
| 3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -411,12 +411,20 @@ | |||
| 411 | /* | 411 | /* |
| 412 | @@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function | 412 | @@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function |
| 413 | @* can use. | 413 | @* can use. |
| 414 | ** CHANGE it if you need lots of (Lua) stack space for your C | 414 | ** CHANGE it if you need a different limit. This limit is arbitrary; |
| 415 | ** functions. This limit is arbitrary; its only purpose is to stop C | 415 | ** its only purpose is to stop C functions to consume unlimited stack |
| 416 | ** functions to consume unlimited stack space. | 416 | ** space. |
| 417 | */ | 417 | */ |
| 418 | #define LUAI_MCS_AUX ((int)(INT_MAX / (4*sizeof(LUA_NUMBER)))) | 418 | /* life is simpler if stack size fits in an int (16 is an estimate |
| 419 | #define LUAI_MAXCSTACK (LUAI_MCS_AUX > SHRT_MAX ? SHRT_MAX : LUAI_MCS_AUX) | 419 | for the size of a Lua value) */ |
| 420 | #if SHRT_MAX < (INT_MAX / 16) | ||
| 421 | #define LUAI_MCS_AUX SHRT_MAX | ||
| 422 | #else | ||
| 423 | #define LUAI_MCS_AUX (INT_MAX / 16) | ||
| 424 | #endif | ||
| 425 | |||
| 426 | /* reserve some space for pseudo-indices */ | ||
| 427 | #define LUAI_MAXCSTACK (LUAI_MCS_AUX - 1000) | ||
| 420 | 428 | ||
| 421 | 429 | ||
| 422 | 430 | ||
