summaryrefslogtreecommitdiff
path: root/proc/hash.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-06-24 21:32:36 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-06-24 21:32:36 +0000
commit461e61630aae5ce7ff17a6714ed93f30c2c3d998 (patch)
tree0d41b9dfb663adb2330bf9c36764b69df88ac5ba /proc/hash.c
parent17008799405f94f21fdd87874096141f7f5f8e47 (diff)
Formerly hash.c.~4~
Diffstat (limited to 'proc/hash.c')
-rw-r--r--proc/hash.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/proc/hash.c b/proc/hash.c
index 52d7620d..89638331 100644
--- a/proc/hash.c
+++ b/proc/hash.c
@@ -35,6 +35,7 @@ struct htable
{
void **tab;
int *ids;
+ void ****locps;
int size;
};
#define HASH_DEL ((void *) -1)
@@ -53,6 +54,7 @@ addhash (struct htable *ht,
{
int h, firsth = -1;
void **oldlist;
+ void ****oldlocps;
int *oldids;
int oldsize;
int i;
@@ -69,6 +71,7 @@ addhash (struct htable *ht,
{
ht->tab[h] = item;
ht->ids[h] = id;
+ ht->locps[h] = locp;
*locp = &ht->tab[h];
return;
}
@@ -78,9 +81,11 @@ addhash (struct htable *ht,
oldlist = ht->tab;
oldsize = ht->size;
oldids = ht->ids;
-
+ oldlocps = ht->locps;
+
ht->size = nextprime (2 * ht->size);
ht->tab = malloc (ht->size * sizeof (void *));
+ ht->locps = malloc (ht->size * sizeof (void ***));
ht->ids = malloc (ht->size * sizeof (int));
bzero (ht->tab, (ht->size * sizeof (void *)));
@@ -88,13 +93,14 @@ addhash (struct htable *ht,
for (i = 0; i < oldsize; i++)
if (oldlist[i] != 0
&& oldlist[i] != HASH_DEL)
- addhash (ht, oldlist[i], locp, oldids[i]);
+ addhash (ht, oldlist[i], oldlocps[i], oldids[i]);
addhash (ht, item, locp, id);
if (oldlist)
{
free (oldlist);
free (oldids);
+ free (oldlocps);
}
}