comparison src/hashtab.c @ 15555:d89c5b339c2a v8.1.0785

patch 8.1.0785: depending on the configuration some functions are unused commit https://github.com/vim/vim/commit/113e10721f42fc2500b63fe95193f8665658a90c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 20 15:30:40 2019 +0100 patch 8.1.0785: depending on the configuration some functions are unused Problem: Depending on the configuration some functions are unused. Solution: Add more #ifdefs, remove unused functions. (Dominique Pelle, closes #3822)
author Bram Moolenaar <Bram@vim.org>
date Sun, 20 Jan 2019 15:45:07 +0100
parents 55ccc2d353bd
children ef00b6bc186b
comparison
equal deleted inserted replaced
15554:496f146a0836 15555:d89c5b339c2a
79 { 79 {
80 if (ht->ht_array != ht->ht_smallarray) 80 if (ht->ht_array != ht->ht_smallarray)
81 vim_free(ht->ht_array); 81 vim_free(ht->ht_array);
82 } 82 }
83 83
84 #if defined(FEAT_SPELL) || defined(PROTO)
84 /* 85 /*
85 * Free the array of a hash table and all the keys it contains. The keys must 86 * Free the array of a hash table and all the keys it contains. The keys must
86 * have been allocated. "off" is the offset from the start of the allocate 87 * have been allocated. "off" is the offset from the start of the allocate
87 * memory to the location of the key (it's always positive). 88 * memory to the location of the key (it's always positive).
88 */ 89 */
101 --todo; 102 --todo;
102 } 103 }
103 } 104 }
104 hash_clear(ht); 105 hash_clear(ht);
105 } 106 }
107 #endif
106 108
107 /* 109 /*
108 * Find "key" in hashtable "ht". "key" must not be NULL. 110 * Find "key" in hashtable "ht". "key" must not be NULL.
109 * Always returns a pointer to a hashitem. If the item was not found then 111 * Always returns a pointer to a hashitem. If the item was not found then
110 * HASHITEM_EMPTY() is TRUE. The pointer is then the place where the key 112 * HASHITEM_EMPTY() is TRUE. The pointer is then the place where the key
176 if (hi->hi_key == HI_KEY_REMOVED && freeitem == NULL) 178 if (hi->hi_key == HI_KEY_REMOVED && freeitem == NULL)
177 freeitem = hi; 179 freeitem = hi;
178 } 180 }
179 } 181 }
180 182
183 #if defined(FEAT_EVAL) || defined(FEAT_SYN_HL) || defined(PROTO)
181 /* 184 /*
182 * Print the efficiency of hashtable lookups. 185 * Print the efficiency of hashtable lookups.
183 * Useful when trying different hash algorithms. 186 * Useful when trying different hash algorithms.
184 * Called when exiting. 187 * Called when exiting.
185 */ 188 */
192 fprintf(stderr, "Number of perturb loops: %ld\r\n", hash_count_perturb); 195 fprintf(stderr, "Number of perturb loops: %ld\r\n", hash_count_perturb);
193 fprintf(stderr, "Percentage of perturb loops: %ld%%\r\n", 196 fprintf(stderr, "Percentage of perturb loops: %ld%%\r\n",
194 hash_count_perturb * 100 / hash_count_lookup); 197 hash_count_perturb * 100 / hash_count_lookup);
195 #endif 198 #endif
196 } 199 }
200 #endif
197 201
198 /* 202 /*
199 * Add item with key "key" to hashtable "ht". 203 * Add item with key "key" to hashtable "ht".
200 * Returns FAIL when out of memory or the key is already present. 204 * Returns FAIL when out of memory or the key is already present.
201 */ 205 */