diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-05-08 16:08:46 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-05-08 16:08:46 -0300 |
| commit | a09bd5961594dad90ffc381bf93c288e7322c2b7 (patch) | |
| tree | 1af8ec4c599237b3a54abcc1844300644f34db32 | |
| parent | 42ff788e53ecffdd6741ca4da63fdedb220178d7 (diff) | |
| download | lua-a09bd5961594dad90ffc381bf93c288e7322c2b7.tar.gz lua-a09bd5961594dad90ffc381bf93c288e7322c2b7.tar.bz2 lua-a09bd5961594dad90ffc381bf93c288e7322c2b7.zip | |
'T.totalmem' accepts 0 for unlimited memory
| -rw-r--r-- | ltests.c | 8 |
1 files changed, 5 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 2.167 2014/02/19 13:51:09 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.168 2014/04/14 18:42:44 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -570,7 +570,9 @@ static int mem_query (lua_State *L) { | |||
| 570 | return 3; | 570 | return 3; |
| 571 | } | 571 | } |
| 572 | else if (lua_isnumber(L, 1)) { | 572 | else if (lua_isnumber(L, 1)) { |
| 573 | l_memcontrol.memlimit = luaL_checkint(L, 1); | 573 | unsigned long limit = cast(unsigned long, luaL_checkinteger(L, 1)); |
| 574 | if (limit == 0) limit = ULONG_MAX; | ||
| 575 | l_memcontrol.memlimit = limit; | ||
| 574 | return 0; | 576 | return 0; |
| 575 | } | 577 | } |
| 576 | else { | 578 | else { |
| @@ -755,7 +757,7 @@ static int upvalue (lua_State *L) { | |||
| 755 | 757 | ||
| 756 | 758 | ||
| 757 | static int newuserdata (lua_State *L) { | 759 | static int newuserdata (lua_State *L) { |
| 758 | size_t size = luaL_checkint(L, 1); | 760 | size_t size = cast(size_t, luaL_checkinteger(L, 1)); |
| 759 | char *p = cast(char *, lua_newuserdata(L, size)); | 761 | char *p = cast(char *, lua_newuserdata(L, size)); |
| 760 | while (size--) *p++ = '\0'; | 762 | while (size--) *p++ = '\0'; |
| 761 | return 1; | 763 | return 1; |
