diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-12-04 15:22:42 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-12-04 15:22:42 -0200 |
commit | 9db1942bac5fb509c6e46ccc825351a6be546792 (patch) | |
tree | d9f8091bf61610b7681c10b9b769031fc787f65e /lstring.c | |
parent | c6eac44a9420a26a2f8907dcd5266a6aecdb18ea (diff) | |
download | lua-9db1942bac5fb509c6e46ccc825351a6be546792.tar.gz lua-9db1942bac5fb509c6e46ccc825351a6be546792.tar.bz2 lua-9db1942bac5fb509c6e46ccc825351a6be546792.zip |
sweep of strings also incremental
Diffstat (limited to 'lstring.c')
-rw-r--r-- | lstring.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.c,v 1.82 2003/12/03 12:30:41 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 1.83 2003/12/03 20:03:07 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 | */ |
@@ -25,9 +25,12 @@ void luaS_freeall (lua_State *L) { | |||
25 | 25 | ||
26 | 26 | ||
27 | void luaS_resize (lua_State *L, int newsize) { | 27 | void luaS_resize (lua_State *L, int newsize) { |
28 | GCObject **newhash = luaM_newvector(L, newsize, GCObject *); | 28 | GCObject **newhash; |
29 | stringtable *tb = &G(L)->strt; | 29 | stringtable *tb; |
30 | int i; | 30 | int i; |
31 | if (G(L)->sweepstrgc > 0) return; /* cannot resize during GC traverse */ | ||
32 | newhash = luaM_newvector(L, newsize, GCObject *); | ||
33 | tb = &G(L)->strt; | ||
31 | for (i=0; i<newsize; i++) newhash[i] = NULL; | 34 | for (i=0; i<newsize; i++) newhash[i] = NULL; |
32 | /* rehash */ | 35 | /* rehash */ |
33 | for (i=0; i<tb->size; i++) { | 36 | for (i=0; i<tb->size; i++) { |