cfg.h: pull stdlib.h for exit()
[0verkill.git] / hash.h
blob44439d6bd6531fbba6fe5d2b61e276672585932a
1 /* HASHING TABLE */
3 #ifndef __HASH_H
4 #define __HASH_H
6 #define TABLE_SIZE 32768 /* size of the hash table (must be power of 2) */
9 struct table_type{ /* HASH TABLE */
10 unsigned char count;
11 struct object_list **pointer;
14 extern struct table_type table[TABLE_SIZE];
17 /* hash function */
18 unsigned int hash(unsigned int id);
21 /* adds object to hash table */
22 void add_to_table(struct object_list *pointer);
25 /* removes object from table */
26 /* returns pointer to the object */
27 /* if there's not such an object returns null */
28 struct object_list * remove_from_table(unsigned int id);
32 /* tests if object is in table */
33 /* returns pointer to the object, if no returns 0 */
34 struct object_list *find_in_table(unsigned int id);
37 /* initializes hash table */
38 void hash_table_init(void);
41 /* removes hash table from memory */
42 void free_hash_table(void);
45 #endif