aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-10-08 15:46:08 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-10-08 15:46:08 -0300
commitb3d0682fb94f56a438dbb4fdb2b3440ccc10cfb4 (patch)
tree746fc9900768dfaf1ddffca35cb4f6fd55903bbf /lgc.c
parent02afc892d5ce5d85e88faac443d7294589ee697a (diff)
downloadlua-b3d0682fb94f56a438dbb4fdb2b3440ccc10cfb4.tar.gz
lua-b3d0682fb94f56a438dbb4fdb2b3440ccc10cfb4.tar.bz2
lua-b3d0682fb94f56a438dbb4fdb2b3440ccc10cfb4.zip
use of different buffers for scanner and concatenation
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/lgc.c b/lgc.c
index afaba8c2..d23e7a02 100644
--- a/lgc.c
+++ b/lgc.c
@@ -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
336static void checkSizes (lua_State *L) { 335static 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