32
32
typedef struct bucket
34
uint h; /* Used for numeric indexing */
34
uint32_t h; /* Used for numeric indexing */
39
39
struct bucket *pNext;
42
42
typedef struct hashtable {
46
uint(*pHashFunction) (const char *arKey, uint nKeyLength);
46
uint(*pHashFunction) (const char *arKey, uint32_t nKeyLength);
47
47
Bucket **arBuckets;
50
extern int completion_hash_init(HashTable *ht, uint nSize);
51
extern int completion_hash_update(HashTable *ht, char *arKey, uint nKeyLength, char *str);
50
extern int completion_hash_init(HashTable *ht, uint32_t nSize);
51
extern int completion_hash_update(HashTable *ht, char *arKey, uint32_t nKeyLength, char *str);
52
52
extern int hash_exists(HashTable *ht, char *arKey);
53
extern Bucket *find_all_matches(HashTable *ht, const char *str, uint length, uint *res_length);
54
extern Bucket *find_longest_match(HashTable *ht, char *str, uint length, uint *res_length);
53
extern Bucket *find_all_matches(HashTable *ht, const char *str, uint32_t length, uint32_t *res_length);
54
extern Bucket *find_longest_match(HashTable *ht, char *str, uint32_t length, uint32_t *res_length);
55
55
extern void add_word(HashTable *ht,char *str);
56
56
extern void completion_hash_clean(HashTable *ht);
57
extern int completion_hash_exists(HashTable *ht, char *arKey, uint nKeyLength);
57
extern int completion_hash_exists(HashTable *ht, char *arKey, uint32_t nKeyLength);
58
58
extern void completion_hash_free(HashTable *ht);
60
uint hashpjw(const char *arKey, uint nKeyLength);
60
uint32_t hashpjw(const char *arKey, uint32_t nKeyLength);
62
62
#endif /* _HASH_ */