diff options
Diffstat (limited to 'lgc.c')
| -rw-r--r-- | lgc.c | 10 |
1 files changed, 4 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.c,v 1.150 2002/09/05 19:57:40 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.151 2002/09/19 19:54:22 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 | */ |
| @@ -332,17 +332,15 @@ static void sweepstrings (lua_State *L, int all) { | |||
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | 334 | ||
| 335 | #define MINBUFFER 256 | ||
| 336 | static void checkSizes (lua_State *L) { | 335 | static void checkSizes (lua_State *L) { |
| 337 | /* check size of string hash */ | 336 | /* check size of string hash */ |
| 338 | if (G(L)->strt.nuse < cast(ls_nstr, G(L)->strt.size/4) && | 337 | if (G(L)->strt.nuse < cast(ls_nstr, G(L)->strt.size/4) && |
| 339 | G(L)->strt.size > MINSTRTABSIZE*2) | 338 | G(L)->strt.size > MINSTRTABSIZE*2) |
| 340 | luaS_resize(L, G(L)->strt.size/2); /* table is too big */ | 339 | luaS_resize(L, G(L)->strt.size/2); /* table is too big */ |
| 341 | /* check size of buffer */ | 340 | /* check size of buffer */ |
| 342 | if (G(L)->Mbuffsize > MINBUFFER*2) { /* is buffer too big? */ | 341 | if (luaZ_sizebuffer(&G(L)->buff) > LUA_MINBUFFER*2) { /* buffer too big? */ |
| 343 | size_t newsize = G(L)->Mbuffsize/2; /* still larger than MINBUFFER */ | 342 | size_t newsize = luaZ_sizebuffer(&G(L)->buff) / 2; |
| 344 | luaM_reallocvector(L, G(L)->Mbuffer, G(L)->Mbuffsize, newsize, char); | 343 | luaZ_resizebuffer(L, &G(L)->buff, newsize); |
| 345 | G(L)->Mbuffsize = newsize; | ||
| 346 | } | 344 | } |
| 347 | } | 345 | } |
| 348 | 346 | ||
