diff options
-rw-r--r-- | lgc.c | 4 | ||||
-rw-r--r-- | liolib.c | 14 |
2 files changed, 8 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 1.79 2001/01/25 16:45:36 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.80 2001/01/26 13:18:00 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -253,7 +253,7 @@ static void collecttable (lua_State *L) { | |||
253 | 253 | ||
254 | 254 | ||
255 | static void checktab (lua_State *L, stringtable *tb) { | 255 | static void checktab (lua_State *L, stringtable *tb) { |
256 | if (tb->nuse < (luint32)(tb->size/4) && tb->size > 10) | 256 | if (tb->nuse < (luint32)(tb->size/4) && tb->size > MINPOWER2) |
257 | luaS_resize(L, tb, tb->size/2); /* table is too big */ | 257 | luaS_resize(L, tb, tb->size/2); /* table is too big */ |
258 | } | 258 | } |
259 | 259 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 1.100 2001/01/25 16:45:36 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 1.101 2001/01/26 11:45:51 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -306,14 +306,12 @@ static int io_read (lua_State *L) { | |||
306 | luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); | 306 | luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); |
307 | success = 1; | 307 | success = 1; |
308 | for (n = 1; n<=nargs && success; n++) { | 308 | for (n = 1; n<=nargs && success; n++) { |
309 | const char *p = luaL_check_string(L, n); | 309 | if (lua_type(L, n) == LUA_TNUMBER) |
310 | if (p[0] != '*') { | 310 | success = read_chars(L, f, (size_t)lua_tonumber(L, n)); |
311 | if (lua_isnumber(L, n)) | ||
312 | success = read_chars(L, f, (size_t)lua_tonumber(L, n)); | ||
313 | else | ||
314 | lua_error(L, "read patterns are deprecated"); | ||
315 | } | ||
316 | else { | 311 | else { |
312 | const char *p = lua_tostring(L, n); | ||
313 | if (!p || p[0] != '*') | ||
314 | lua_error(L, "invalid `read' option"); | ||
317 | switch (p[1]) { | 315 | switch (p[1]) { |
318 | case 'n': /* number */ | 316 | case 'n': /* number */ |
319 | success = read_number(L, f); | 317 | success = read_number(L, f); |