Mercurial > vim
comparison src/hashtable.c @ 625:81fe2ccc1207 v7.0179
updated for version 7.0179
author | vimboss |
---|---|
date | Thu, 12 Jan 2006 23:22:24 +0000 |
parents | 4b9fef49d7ff |
children |
comparison
equal
deleted
inserted
replaced
624:91e7d4a7b3b0 | 625:81fe2ccc1207 |
---|---|
84 if (ht->ht_array != ht->ht_smallarray) | 84 if (ht->ht_array != ht->ht_smallarray) |
85 vim_free(ht->ht_array); | 85 vim_free(ht->ht_array); |
86 } | 86 } |
87 | 87 |
88 /* | 88 /* |
89 * Free the array of a hash table and all the keys it contains. The keys must | |
90 * have been allocated. "off" is the offset from the start of the allocate | |
91 * memory to the location of the key (it's always positive). | |
92 */ | |
93 void | |
94 hash_clear_all(ht, off) | |
95 hashtab_T *ht; | |
96 int off; | |
97 { | |
98 int todo; | |
99 hashitem_T *hi; | |
100 | |
101 todo = ht->ht_used; | |
102 for (hi = ht->ht_array; todo > 0; ++hi) | |
103 { | |
104 if (!HASHITEM_EMPTY(hi)) | |
105 { | |
106 vim_free(hi->hi_key - off); | |
107 --todo; | |
108 } | |
109 } | |
110 hash_clear(ht); | |
111 } | |
112 | |
113 /* | |
89 * Find "key" in hashtable "ht". "key" must not be NULL. | 114 * Find "key" in hashtable "ht". "key" must not be NULL. |
90 * Always returns a pointer to a hashitem. If the item was not found then | 115 * Always returns a pointer to a hashitem. If the item was not found then |
91 * HASHITEM_EMPTY() is TRUE. The pointer is then the place where the key | 116 * HASHITEM_EMPTY() is TRUE. The pointer is then the place where the key |
92 * would be added. | 117 * would be added. |
93 * WARNING: The returned pointer becomes invalid when the hashtable is changed | 118 * WARNING: The returned pointer becomes invalid when the hashtable is changed |