blob: 54bd87f6d9c51f74923b5a0019ab085d5384f1a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <string.h>
#include "strhashfunc.h"
unsigned int hashtable_strhashfunc(void * p)
{
const char * str = (const char *)p;
unsigned int hash = 5381;
int c;
while ((c = *str++) != '\0')
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
return hash;
}
int hashtable_strequalfunc(void * str1, void * str2)
{
return !strcmp(str1, str2);
}
|