diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-11 17:14:59 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-11 17:14:59 -0200 |
commit | a2a2abcba4b3a221780a4499880aa16bf76e8204 (patch) | |
tree | 939f2fb27e61bc5171118e0d45659b4a209de566 /lstring.c | |
parent | 2e5179259655ffd137067f5dc47803740b7937ac (diff) | |
download | lua-a2a2abcba4b3a221780a4499880aa16bf76e8204.tar.gz lua-a2a2abcba4b3a221780a4499880aa16bf76e8204.tar.bz2 lua-a2a2abcba4b3a221780a4499880aa16bf76e8204.zip |
new function 'luaC_runtilstate' to advance GC until a "valid" state
Diffstat (limited to 'lstring.c')
-rw-r--r-- | lstring.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.c,v 2.12 2009/04/17 14:40:13 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 2.13 2009/04/29 17:09:41 roberto Exp roberto $ |
3 | ** String table (keeps all strings handled by Lua) | 3 | ** String table (keeps all strings handled by Lua) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -22,8 +22,8 @@ | |||
22 | void luaS_resize (lua_State *L, int newsize) { | 22 | void luaS_resize (lua_State *L, int newsize) { |
23 | int i; | 23 | int i; |
24 | stringtable *tb = &G(L)->strt; | 24 | stringtable *tb = &G(L)->strt; |
25 | if (G(L)->gcstate == GCSsweepstring) | 25 | /* cannot resize while GC is traversing strings */ |
26 | return; /* cannot resize during GC traverse */ | 26 | luaC_runtilstate(L, ~GCSsweepstring); |
27 | if (newsize > tb->size) { | 27 | if (newsize > tb->size) { |
28 | luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *); | 28 | luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *); |
29 | for (i = tb->size; i < newsize; i++) tb->hash[i] = NULL; | 29 | for (i = tb->size; i < newsize; i++) tb->hash[i] = NULL; |