Commit 65c01f60 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Fix up types for FNV hashing

git-svn-id: file:///svn/tokudb@119 c7de825b-a66e-492c-adef-691d508d4ae1
parent 088f1153
......@@ -24,7 +24,7 @@ int toku_hashtable_create (HASHTABLE *h) {
return 0;
}
static void hash_find_internal (HASHTABLE tab, const char *key, ITEMLEN keylen, HASHELT *hashelt, HASHELT **prev_ptr) {
static void hash_find_internal (HASHTABLE tab, const unsigned char *key, ITEMLEN keylen, HASHELT *hashelt, HASHELT **prev_ptr) {
unsigned int h = hash_key (key, keylen) % tab->arraysize;
HASHELT he;
HASHELT *prev = &tab->array[h];
......@@ -59,7 +59,7 @@ int toku_hash_rehash_everything (HASHTABLE tab, int newarraysize) {
for (i=0; i<tab->arraysize; i++) {
HASHELT he;
while ((he=tab->array[i])!=0) {
unsigned int h = hash_key(he->key, he->keylen)%newarraysize;
unsigned int h = hash_key((unsigned char *)he->key, he->keylen)%newarraysize;
tab->array[i] = he->next;
he->next = newarray[h];
newarray[h] = he;
......@@ -73,7 +73,7 @@ int toku_hash_rehash_everything (HASHTABLE tab, int newarraysize) {
return 0;
}
int toku_hash_insert (HASHTABLE tab, const char *key, ITEMLEN keylen, const char *val, ITEMLEN vallen)
int toku_hash_insert (HASHTABLE tab, const void *key, ITEMLEN keylen, const void *val, ITEMLEN vallen)
{
unsigned int h = hash_key (key,keylen)%tab->arraysize;
{
......@@ -100,7 +100,7 @@ int toku_hash_insert (HASHTABLE tab, const char *key, ITEMLEN keylen, const char
}
}
int toku_hash_delete (HASHTABLE tab, const char *key, ITEMLEN keylen) {
int toku_hash_delete (HASHTABLE tab, const void *key, ITEMLEN keylen) {
HASHELT he, *prev_ptr;
//printf("%s:%d deleting %s (bucket %d)\n", __FILE__, __LINE__, key, hash_key(key,keylen)%tab->arraysize);
hash_find_internal(tab, key, keylen, &he, &prev_ptr);
......
......@@ -15,10 +15,10 @@ int toku_hashtable_create (HASHTABLE*);
int toku_hash_find (HASHTABLE tab, bytevec key, ITEMLEN keylen, bytevec*data, ITEMLEN *datalen);
/* Replace the key if it was already there. */
int toku_hash_insert (HASHTABLE tab, const char *key, ITEMLEN keylen, const char *data, ITEMLEN datalen);
int toku_hash_insert (HASHTABLE tab, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen);
/* It is OK to delete something that isn't there. */
int toku_hash_delete (HASHTABLE tab, const char *key, ITEMLEN keylen);
int toku_hash_delete (HASHTABLE tab, const void *key, ITEMLEN keylen);
void toku_hashtable_free(HASHTABLE *tab);
int toku_hashtable_n_entries(HASHTABLE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment