/* ** Character Hash Functions ** ** Copyright (C) 1996-2005 Herbert Poetzl */ #ifndef _CHASH_H_ #define _CHASH_H_ struct hash_entry { long hashcode; char *key; void *value; }; struct hash_control { int sizelog; long mask; long entries; long memsize; struct hash_entry *data; struct hash_entry *wall; }; typedef struct hash_control *hash; struct hash_state { hash table; long hashpos; struct { unsigned int active:1; } sflags; }; typedef struct hash_state hstate; hash hash_new(long capacity); void hash_free(hash table); void hash_free_keys(hash table); void hash_empty(hash table); int hash_insert(hash table, const char *key, void *value, char copy); int hash_inject(hash table, const char *key, void *value); void * hash_replace(hash table, const char *key, void *value); void * hash_delete(hash table, const char *key, const char **oldkey); void * hash_lookup(hash table, const char *key); hstate hash_state(hash table); void * hash_next(hstate *state, char **key); int hash_count(hash table); char * _copy_string(const char *string); #endif /* _CHASH_H_ */