00001 #ifndef _STRHASH_H_INCLUDE
00002 #define _STRHASH_H_INCLUDE
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #define HASH_SZ 97
00039
00040 typedef struct _node {
00041 char *key;
00042 void *data;
00043 struct _node *next;
00044 } hash_node;
00045
00046 typedef struct {
00047 int size;
00048 hash_node **buckets;
00049 } hash_table;
00050
00051 hash_table *hash_create(int size);
00052 void hash_destroy(hash_table *table, char *key,
00053 void (*nukefunc)(char *k, void *d));
00054 void *hash_search(hash_table *table, char *key, void *datum,
00055 void (*replace_func)(void *d));
00056 void hash_traverse(hash_table *table,
00057 int (*func)(char *k, void *d, void *arg), void *arg);
00058 void hash_purge(hash_table *table, void (*purge_func)(char *k, void *d));
00059
00060 #ifdef HASH_STATS
00061 extern void hash_stats();
00062 #endif
00063
00064 #endif