aboutsummaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorWaldemar Celes <celes@tecgraf.puc-rio.br>1994-10-17 17:03:23 -0200
committerWaldemar Celes <celes@tecgraf.puc-rio.br>1994-10-17 17:03:23 -0200
commitf8c8159362f4bb8820908085adcb06900ef33b4c (patch)
tree2cbe498f152dad434973e4b718ba04dd08ca3b83 /hash.c
parentd1c5f4294365e9c5dbcd7f57bd0e3d55b548329c (diff)
downloadlua-f8c8159362f4bb8820908085adcb06900ef33b4c.tar.gz
lua-f8c8159362f4bb8820908085adcb06900ef33b4c.tar.bz2
lua-f8c8159362f4bb8820908085adcb06900ef33b4c.zip
adaptative garbage collection.
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/hash.c b/hash.c
index 916a0d43..97d6efb0 100644
--- a/hash.c
+++ b/hash.c
@@ -3,7 +3,7 @@
3** hash manager for lua 3** hash manager for lua
4*/ 4*/
5 5
6char *rcs_hash="$Id: hash.c,v 2.7 1994/09/08 15:27:10 celes Exp celes $"; 6char *rcs_hash="$Id: hash.c,v 2.8 1994/10/11 12:59:49 celes Exp $";
7 7
8#include <string.h> 8#include <string.h>
9#include <stdlib.h> 9#include <stdlib.h>
@@ -52,7 +52,7 @@ static int redimension (int nhash)
52 return nhash*2+1; 52 return nhash*2+1;
53} 53}
54 54
55static int index (Hash *t, Object *ref) /* hash function */ 55static int hashindex (Hash *t, Object *ref) /* hash function */
56{ 56{
57 switch (tag(ref)) 57 switch (tag(ref))
58 { 58 {
@@ -97,7 +97,7 @@ static int equalObj (Object *t1, Object *t2)
97 97
98static int present (Hash *t, Object *ref) 98static int present (Hash *t, Object *ref)
99{ 99{
100 int h = index(t, ref); 100 int h = hashindex(t, ref);
101 if (h < 0) return h; 101 if (h < 0) return h;
102 while (tag(ref(node(t, h))) != T_NIL) 102 while (tag(ref(node(t, h))) != T_NIL)
103 { 103 {
@@ -195,6 +195,7 @@ void lua_hashcollector (void)
195 if (prev == NULL) listhead = next; 195 if (prev == NULL) listhead = next;
196 else prev->next = next; 196 else prev->next = next;
197 hashdelete(curr_array); 197 hashdelete(curr_array);
198 ++lua_recovered;
198 } 199 }
199 else 200 else
200 { 201 {