Commit | Line | Data |
8665f9e4 |
1 | /* hash.h |
a687059c |
2 | * |
8665f9e4 |
3 | * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2005 |
4bb101f2 |
4 | * by Larry Wall and others |
a687059c |
5 | * |
352d5a3a |
6 | * You may distribute under the terms of either the GNU General Public |
7 | * License or the Artistic License, as specified in the README file. |
8d063cd8 |
8 | */ |
9 | |
10 | #define FILLPCT 60 /* don't make greater than 99 */ |
11 | |
12 | #ifdef DOINIT |
8665f9e4 |
13 | char const coeff[] = { |
8d063cd8 |
14 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
15 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
16 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
17 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
18 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
19 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
20 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
21 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1}; |
22 | #else |
8665f9e4 |
23 | extern const char coeff[]; |
8d063cd8 |
24 | #endif |
25 | |
26 | typedef struct hentry HENT; |
27 | |
28 | struct hentry { |
29 | HENT *hent_next; |
30 | char *hent_key; |
31 | STR *hent_val; |
32 | int hent_hash; |
33 | }; |
34 | |
35 | struct htbl { |
36 | HENT **tbl_array; |
37 | int tbl_max; |
38 | int tbl_fill; |
39 | int tbl_riter; /* current root of iterator */ |
40 | HENT *tbl_eiter; /* current entry of iterator */ |
41 | }; |
42 | |
20ce7b12 |
43 | STR * hfetch ( HASH *tb, char *key ); |
44 | int hiterinit ( HASH *tb ); |
20ce7b12 |
45 | HASH * hnew ( void ); |
46 | void hsplit ( HASH *tb ); |
47 | bool hstore ( HASH *tb, char *key, STR *val ); |