diff options
author | Stef Walter <stef@memberwebs.com> | 2008-03-02 01:25:00 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2008-03-02 01:25:00 +0000 |
commit | 9a78f86f773cbf34e29ec51fc06e3f04072c88d0 (patch) | |
tree | 00054e6e536769a35b4215567755494486cc36ec /common/hash.c | |
parent | ec1a79b0f75cfd34085e046ecb30382a402ea318 (diff) |
- Support failover between multiple agents
- Support table queries
- Major refactoring of internals.
Diffstat (limited to 'common/hash.c')
-rw-r--r-- | common/hash.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/common/hash.c b/common/hash.c index 9acd2df..512a914 100644 --- a/common/hash.c +++ b/common/hash.c @@ -374,6 +374,25 @@ void* hsh_rem(hsh_t* ht, const void* key, size_t klen) return val; } +void hsh_clear(hsh_t* ht) +{ + hsh_entry_t *he, *next; + int i; + + /* Free all entries in the array */ + for (i = 0; i < ht->max; ++i) { + he = ht->array[i]; + while (he) { + next = he->next; + free (he); + he = next; + } + } + + memset (ht->array, 0, ht->max * sizeof (hsh_entry_t*)); + ht->count = 0; +} + unsigned int hsh_count(hsh_t* ht) { return ht->count; |