diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-09-08 11:23:09 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-09-08 11:23:09 -0300 |
| commit | 0de2065f4e7cbbbe301b07835b9dd0b1bd1a4bbb (patch) | |
| tree | 6f578771ff27c6a352b52ba721fbcf163c610945 /ldo.h | |
| parent | ee165043ef917688d6e9151fc1a98d1e0f3e6ab1 (diff) | |
| download | lua-0de2065f4e7cbbbe301b07835b9dd0b1bd1a4bbb.tar.gz lua-0de2065f4e7cbbbe301b07835b9dd0b1bd1a4bbb.tar.bz2 lua-0de2065f4e7cbbbe301b07835b9dd0b1bd1a4bbb.zip | |
tighter tests for stack overflow
Diffstat (limited to 'ldo.h')
| -rw-r--r-- | ldo.h | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.h,v 2.1 2003/12/10 12:13:36 roberto Exp roberto $ | 2 | ** $Id: ldo.h,v 2.2 2004/05/14 19:25:09 roberto Exp roberto $ |
| 3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -17,7 +17,7 @@ | |||
| 17 | ** macro to control inclusion of some hard tests on stack reallocation | 17 | ** macro to control inclusion of some hard tests on stack reallocation |
| 18 | */ | 18 | */ |
| 19 | #ifndef HARDSTACKTESTS | 19 | #ifndef HARDSTACKTESTS |
| 20 | #define condhardstacktests(x) { /* empty */ } | 20 | #define condhardstacktests(x) ((void)0) |
| 21 | #else | 21 | #else |
| 22 | #define condhardstacktests(x) x | 22 | #define condhardstacktests(x) x |
| 23 | #endif | 23 | #endif |
| @@ -26,7 +26,7 @@ | |||
| 26 | #define luaD_checkstack(L,n) \ | 26 | #define luaD_checkstack(L,n) \ |
| 27 | if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ | 27 | if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ |
| 28 | luaD_growstack(L, n); \ | 28 | luaD_growstack(L, n); \ |
| 29 | else condhardstacktests(luaD_reallocstack(L, L->stacksize)); | 29 | else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | #define incr_top(L) {luaD_checkstack(L,1); L->top++;} | 32 | #define incr_top(L) {luaD_checkstack(L,1); L->top++;} |
