6 Copyright (C) 2000-2003 Kern Sibbald and John Walker
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of
11 the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public
19 License along with this program; if not, write to the Free
20 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25 /* ========================================================================
27 * Hash table class -- htable
32 void *next; /* next hash item */
33 char *key; /* key this item */
34 uint32_t hash; /* hash for this key */
38 hlink **table; /* hash table */
39 int loffset; /* link offset in item */
40 uint32_t num_items; /* current number of items */
41 uint32_t max_items; /* maximum items before growing */
42 uint32_t buckets; /* size of hash table */
43 uint32_t hash; /* temp storage */
44 uint32_t index; /* temp storage */
45 uint32_t mask; /* "remainder" mask */
46 uint32_t rshift; /* amount to shift down */
47 hlink *walkptr; /* table walk pointer */
48 uint32_t walk_index; /* table walk index */
49 void hash_index(char *key); /* produce hash key,index */
50 void grow_table(); /* grow the table */
52 htable(void *item, void *link, int tsize = 31);
53 void init(void *item, void *link, int tsize = 31);
54 bool insert(char *key, void *item);
55 void *lookup(char *key);
56 void *first(); /* get first item in table */
57 void *next(); /* get next item in table */
59 void stats(); /* print stats about the table */
60 uint32_t size(); /* return size of table */
61 void * operator new(size_t);
62 void operator delete(void *);