aboutsummaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-25 17:27:03 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-25 17:27:03 -0200
commit10bdd838440b082aaf70748571b443f7c941db81 (patch)
tree07b842429d1bdba801655088d96674dbed2cb612 /tree.c
parentfbfa1cbe9becd8e270ed4567260e5b73cbaf6d1a (diff)
downloadlua-10bdd838440b082aaf70748571b443f7c941db81.tar.gz
lua-10bdd838440b082aaf70748571b443f7c941db81.tar.bz2
lua-10bdd838440b082aaf70748571b443f7c941db81.zip
new hash function; hash value for strings are kept with the string
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tree.c b/tree.c
index 90fa64ab..9a9daf19 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.9 1994/11/18 19:27:38 roberto Exp roberto $"; 6char *rcs_tree="$Id: tree.c,v 1.10 1994/11/23 14:31:11 roberto Stab roberto $";
7 7
8 8
9#include <string.h> 9#include <string.h>
@@ -37,6 +37,7 @@ static TreeNode *tree_create (TreeNode **node, char *str)
37 (*node)->left = (*node)->right = NULL; 37 (*node)->left = (*node)->right = NULL;
38 strcpy((*node)->ts.str, str); 38 strcpy((*node)->ts.str, str);
39 (*node)->ts.marked = 0; 39 (*node)->ts.marked = 0;
40 (*node)->ts.hash = 0;
40 (*node)->varindex = (*node)->constindex = NOT_USED; 41 (*node)->varindex = (*node)->constindex = NOT_USED;
41 return *node; 42 return *node;
42 } 43 }
@@ -59,6 +60,7 @@ TaggedString *lua_createstring (char *str)
59 lua_pack(); 60 lua_pack();
60 newString = (StringNode *)luaI_malloc(sizeof(StringNode)+strlen(str)); 61 newString = (StringNode *)luaI_malloc(sizeof(StringNode)+strlen(str));
61 newString->ts.marked = 0; 62 newString->ts.marked = 0;
63 newString->ts.hash = 0;
62 strcpy(newString->ts.str, str); 64 strcpy(newString->ts.str, str);
63 newString->next = string_root; 65 newString->next = string_root;
64 string_root = newString; 66 string_root = newString;