diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-01-12 23:22:24 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-01-12 23:22:24 +0000 |
commit | 4770d09abd866bb53d95895dc6a5c5fe7cccb619 (patch) | |
tree | b9ca6f4a66c7591a84cfe88fb21edb31db906a4e /src/hashtable.c | |
parent | 1cbe5f739d4e75b5e16b85ae79ff0434a641b03d (diff) | |
download | vim-4770d09abd866bb53d95895dc6a5c5fe7cccb619.zip |
updated for version 7.0179
Diffstat (limited to 'src/hashtable.c')
-rw-r--r-- | src/hashtable.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/hashtable.c b/src/hashtable.c index 904be4704..066f0f3cb 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -86,6 +86,31 @@ hash_clear(ht) } /* + * Free the array of a hash table and all the keys it contains. The keys must + * have been allocated. "off" is the offset from the start of the allocate + * memory to the location of the key (it's always positive). + */ + void +hash_clear_all(ht, off) + hashtab_T *ht; + int off; +{ + int todo; + hashitem_T *hi; + + todo = ht->ht_used; + for (hi = ht->ht_array; todo > 0; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + vim_free(hi->hi_key - off); + --todo; + } + } + hash_clear(ht); +} + +/* * Find "key" in hashtable "ht". "key" must not be NULL. * Always returns a pointer to a hashitem. If the item was not found then * HASHITEM_EMPTY() is TRUE. The pointer is then the place where the key |