This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
1 #ifndef _PRELOOKUP_H_
2 #define _PRELOOKUP_H_
3
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <pthread.h>
7
8 #define LOADFACTOR 0.75
9 #define HASH_SIZE 100
10
11 typedef struct prehashlistnode {
12         unsigned int key;
13         void *val; //this can be cast to another type or used to point to a larger structure
14         struct prehashlistnode *next;
15 } prehashlistnode_t;
16
17 typedef struct prehashtable {
18         prehashlistnode_t *table;       // points to beginning of hash table
19         unsigned int size;
20         unsigned int numelements;
21         float loadfactor;
22         pthread_mutex_t lock;
23         pthread_cond_t cond;
24 } prehashtable_t;
25
26 /* Prototypes for hash*/
27 unsigned int prehashCreate(unsigned int size, float loadfactor);
28 unsigned int prehashFunction(unsigned int key);
29 unsigned int prehashInsert(unsigned int key, void *val);
30 void *prehashSearch(unsigned int key); //returns val, NULL if not found
31 unsigned int prehashRemove(unsigned int key); //returns -1 if not found
32 unsigned int prehashResize(unsigned int newsize);
33 /* end hash */
34
35 #endif
36