aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tree.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/tree.c b/tree.c
index 30e4d07c..0141a99c 100644
--- a/tree.c
+++ b/tree.c
@@ -3,7 +3,7 @@
3** TecCGraf - PUC-Rio 3** TecCGraf - PUC-Rio
4*/ 4*/
5 5
6char *rcs_tree="$Id: tree.c,v 1.23 1997/03/31 14:02:58 roberto Exp roberto $"; 6char *rcs_tree="$Id: tree.c,v 1.24 1997/03/31 14:17:09 roberto Exp roberto $";
7 7
8 8
9#include <string.h> 9#include <string.h>
@@ -40,9 +40,22 @@ static unsigned long hash (char *buff, long size)
40 return h; 40 return h;
41} 41}
42 42
43
44static void luaI_inittree (void)
45{
46 int i;
47 for (i=0; i<NUM_HASHS; i++) {
48 string_root[i].size = 0;
49 string_root[i].nuse = 0;
50 string_root[i].hash = NULL;
51 }
52}
53
54
43static void initialize (void) 55static void initialize (void)
44{ 56{
45 initialized = 1; 57 initialized = 1;
58 luaI_inittree();
46 luaI_addReserved(); 59 luaI_addReserved();
47 luaI_initsymbol(); 60 luaI_initsymbol();
48 luaI_initconstant(); 61 luaI_initconstant();
@@ -60,8 +73,7 @@ static void grow (stringtable *tb)
60 /* rehash */ 73 /* rehash */
61 tb->nuse = 0; 74 tb->nuse = 0;
62 for (i=0; i<tb->size; i++) 75 for (i=0; i<tb->size; i++)
63 if (tb->hash[i] != NULL && tb->hash[i] != &EMPTY) 76 if (tb->hash[i] != NULL && tb->hash[i] != &EMPTY) {
64 {
65 int h = tb->hash[i]->hash%newsize; 77 int h = tb->hash[i]->hash%newsize;
66 while (newhash[h]) 78 while (newhash[h])
67 h = (h+1)%newsize; 79 h = (h+1)%newsize;