git-svn-id: http://svn.openzap.org/svn/openzap/trunk@15 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale
2007-05-17 16:57:26 +00:00
parent 22433a9970
commit f57307bf91
10 changed files with 145 additions and 50 deletions

View File

@@ -22,13 +22,13 @@ static const unsigned int primes[] = {
805306457, 1610612741
};
const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0]);
const float max_load_factor = 0.65f;
const float max_load_factor = 0.65;
/*****************************************************************************/
struct hashtable *
create_hashtable(unsigned int minsize,
unsigned int (*hashf) (const void*),
int (*eqf) (const void*,const void*))
unsigned int (*hashf) (void*),
int (*eqf) (void*,void*))
{
struct hashtable *h;
unsigned int pindex, size = primes[0];
@@ -54,7 +54,7 @@ create_hashtable(unsigned int minsize,
/*****************************************************************************/
unsigned int
hash(struct hashtable *h, const void *k)
hash(struct hashtable *h, void *k)
{
/* Aim to protect against poor hash functions by adding logic here
* - logic taken from java 1.4 hashtable source */
@@ -160,7 +160,7 @@ hashtable_insert(struct hashtable *h, void *k, void *v)
/*****************************************************************************/
void * /* returns value associated with key */
hashtable_search(struct hashtable *h, const void *k)
hashtable_search(struct hashtable *h, void *k)
{
struct entry *e;
unsigned int hashvalue, index;