- fix one more use of SidebarWidth without checking for visibility (reported by Trey...
[apps/madmutt.git] / hash.h
1 /*
2  * Copyright notice from original mutt:
3  * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
4  *
5  * This file is part of mutt-ng, see http://www.muttng.org/.
6  * It's licensed under the GNU General Public License,
7  * please see the file GPL in the top level source directory.
8  */
9
10 #ifndef _HASH_H
11 #define _HASH_H
12
13 struct hash_elem {
14   const char *key;
15   void *data;
16   struct hash_elem *next;
17 };
18
19 typedef struct {
20   int nelem, curnelem;
21   struct hash_elem **table;
22 } HASH;
23
24 #define hash_find(table, key) hash_find_hash(table, hash_string ((unsigned char *)key, table->nelem), key)
25
26 #define hash_delete(table,key,data,destroy) hash_delete_hash(table, hash_string ((unsigned char *)key, table->nelem), key, data, destroy)
27
28 HASH *hash_create (int nelem);
29 int hash_string (const unsigned char *s, int n);
30 int hash_insert (HASH * table, const char *key, void *data, int allow_dup);
31 HASH *hash_resize (HASH * table, int nelem);
32 void *hash_find_hash (const HASH * table, int hash, const char *key);
33 void hash_delete_hash (HASH * table, int hash, const char *key,
34                        const void *data, void (*destroy) (void *));
35 void hash_destroy (HASH ** hash, void (*destroy) (void *));
36
37 void hash_map (HASH* table,
38                void (*mapfunc) (const char* key, void* data, unsigned long more),
39                unsigned long more);
40
41 #endif