X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FHash.c;h=1083b8a7ccef51871cef56dae6a650498c935d48;hb=bf8b921f2baf1135d23e6a80a8b0bc5e258c1c45;hp=e1cc0a3c2c1cc6240c4f4d50585e6f697f92ed33;hpb=c4ec36d6a2886b30f932276c6db5430f8d739ad6;p=ghc-hetmet.git diff --git a/ghc/rts/Hash.c b/ghc/rts/Hash.c index e1cc0a3..1083b8a 100644 --- a/ghc/rts/Hash.c +++ b/ghc/rts/Hash.c @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------- - * $Id: Hash.c,v 1.2 2000/10/06 15:34:29 simonmar Exp $ + * $Id: Hash.c,v 1.10 2003/03/25 17:58:47 sof Exp $ * * (c) The AQUA Project, Glasgow University, 1995-1998 * (c) The GHC Team, 1999 @@ -9,10 +9,14 @@ * pp. 446 -- 457. * -------------------------------------------------------------------------- */ +#include "PosixSource.h" #include "Rts.h" #include "Hash.h" #include "RtsUtils.h" +#include +#include + #define HSEGSIZE 1024 /* Size of a single hash table segment */ /* Also the minimum size of a hash table */ #define HDIRSIZE 1024 /* Size of the segment directory */ @@ -244,7 +248,7 @@ insertHashTable(HashTable *table, StgWord key, void *data) /* We want no duplicates */ ASSERT(lookupHashTable(table, key) == NULL); - + /* When the average load gets too high, we expand the table */ if (++table->kcount >= HLOAD * table->bcount) expand(table); @@ -281,6 +285,7 @@ removeHashTable(HashTable *table, StgWord key, void *data) table->dir[segment][index] = hl->next; else prev->next = hl->next; + freeHashList(hl); table->kcount--; return hl->data; } @@ -320,11 +325,11 @@ freeHashTable(HashTable *table, void (*freeDataFun)(void *) ) } index--; } - free(table->dir[segment]); + stgFree(table->dir[segment]); segment--; index = HSEGSIZE - 1; } - free(table); + stgFree(table); } /* -----------------------------------------------------------------------------