• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/bind9-45.100/bind9/contrib/idn/idnkit-1.0-src/lib/

Lines Matching refs:hash

59  * Initially, the number of hash buckets is INITIAL_HASH_SIZE.
60 * As the more elements are put in the hash, the number of elements
85 unsigned long hash);
87 static idn_result_t expand_bins(idn__strhash_t hash, int new_size);
91 idn__strhash_t hash;
100 if ((hash = malloc(sizeof(struct idn__strhash))) == NULL) {
101 WARNING(("idn__strhash_create: malloc failed (hash)\n"));
104 hash->nbins = 0;
105 hash->nelements = 0;
106 hash->bins = NULL;
107 if ((r = expand_bins(hash, INITIAL_HASH_SIZE)) != idn_success) {
109 free(hash);
113 *hashp = hash;
119 idn__strhash_destroy(idn__strhash_t hash, idn__strhash_freeproc_t proc) {
122 assert(hash != NULL && hash->bins != NULL);
124 for (i = 0; i < hash->nbins; i++) {
125 strhash_entry_t *bin = hash->bins[i];
136 free(hash->bins);
137 free(hash);
141 idn__strhash_put(idn__strhash_t hash, const char *key, void *value) {
145 assert(hash != NULL && key != NULL);
148 h_index = h % hash->nbins;
150 if ((entry = find_entry(hash->bins[h_index], key, h)) != NULL) {
159 entry->next = hash->bins[h_index];
160 hash->bins[h_index] = entry;
161 hash->nelements++;
163 if (hash->nelements > hash->nbins * THRESHOLD) {
165 r = expand_bins(hash, hash->nbins * FACTOR);
167 TRACE(("idn__strhash_put: hash table "
177 idn__strhash_get(idn__strhash_t hash, const char *key, void **valuep) {
181 assert(hash != NULL && key != NULL && valuep != NULL);
184 entry = find_entry(hash->bins[h % hash->nbins], key, h);
193 idn__strhash_exists(idn__strhash_t hash, const char *key) {
196 assert(hash != NULL && key != NULL);
199 return (find_entry(hash->bins[h % hash->nbins], key, h) != NULL);
215 find_entry(strhash_entry_t *entry, const char *key, unsigned long hash) {
219 if (entry->hash_value == hash && strcmp(key, entry->key) == 0)
247 expand_bins(idn__strhash_t hash, int new_size) {
258 old_bins = hash->bins;
259 old_size = hash->nbins;
269 /* ..and move to the new hash. */
276 hash->nbins = new_size;
277 hash->bins = new_bins;