File: hashtable.h

package info (click to toggle)
crossfire 1.75.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,168 kB
  • sloc: ansic: 83,169; sh: 4,659; perl: 1,736; lex: 1,443; makefile: 1,199; python: 43
file content (20 lines) | stat: -rw-r--r-- 720 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* Usually we will store only about 10 or so elements, however we may get
 * cases of a fair bit more and we should handle those cases efficently.
 * hashptr() assumes this value will fit in int.
 */
#define PTR_ASSOC_TABLESIZE 251

typedef struct _ptr_assoc {
    struct _ptr_assoc **array;
    struct _ptr_assoc *previous;
    struct _ptr_assoc *next;
    void *key;
    void *value;
} ptr_assoc;

typedef ptr_assoc *ptr_assoc_table[PTR_ASSOC_TABLESIZE];

extern void init_ptr_assoc_table(ptr_assoc **hash_table);
extern void add_ptr_assoc(ptr_assoc **hash_table, void *key, void *value);
extern void *find_assoc_value(ptr_assoc **hash_table, void *key);
extern void free_ptr_assoc(ptr_assoc **hash_table, void *key);