diff options
Diffstat (limited to 'lstring.c')
-rw-r--r-- | lstring.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.c,v 1.22 1999/10/04 17:51:04 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 1.23 1999/10/11 16:13:11 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 | */ |
@@ -48,6 +48,7 @@ void luaS_freeall (void) { | |||
48 | luaM_free(L->string_root[i].hash); | 48 | luaM_free(L->string_root[i].hash); |
49 | } | 49 | } |
50 | luaM_free(L->string_root); | 50 | luaM_free(L->string_root); |
51 | LUA_ASSERT(init_hash[0] == NULL, "init_hash corrupted"); | ||
51 | } | 52 | } |
52 | 53 | ||
53 | 54 | ||
@@ -59,8 +60,8 @@ static unsigned long hash_s (const char *s, long l) { | |||
59 | } | 60 | } |
60 | 61 | ||
61 | 62 | ||
62 | static void grow (stringtable *tb) { | 63 | void luaS_grow (stringtable *tb) { |
63 | int ns = luaO_redimension(tb->size*2); /* new size */ | 64 | int ns = luaO_redimension(tb->nuse*2); /* new size */ |
64 | TaggedString **newhash = luaM_newvector(ns, TaggedString *); | 65 | TaggedString **newhash = luaM_newvector(ns, TaggedString *); |
65 | int i; | 66 | int i; |
66 | for (i=0; i<ns; i++) newhash[i] = NULL; | 67 | for (i=0; i<ns; i++) newhash[i] = NULL; |
@@ -122,7 +123,7 @@ static void newentry (stringtable *tb, TaggedString *ts, int h) { | |||
122 | tb->hash = luaM_newvector(1, TaggedString *); /* so, `clone' it */ | 123 | tb->hash = luaM_newvector(1, TaggedString *); /* so, `clone' it */ |
123 | tb->hash[0] = NULL; | 124 | tb->hash[0] = NULL; |
124 | } | 125 | } |
125 | grow(tb); | 126 | luaS_grow(tb); |
126 | h = ts->hash%tb->size; /* new hash position */ | 127 | h = ts->hash%tb->size; /* new hash position */ |
127 | } | 128 | } |
128 | ts->nexthash = tb->hash[h]; /* chain new entry */ | 129 | ts->nexthash = tb->hash[h]; /* chain new entry */ |