diff options
author | Martin Willi <martin@strongswan.org> | 2008-12-05 10:01:52 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2008-12-05 10:01:52 +0000 |
commit | 19e0010f51f871f9eb8e3c0b2bc451d7f32e556c (patch) | |
tree | f9a2231d324f4f2cd7beab1598ab5e8db07d191d /src/libstrongswan/utils/hashtable.c | |
parent | a6d7a6107cf18cc892381b4770bbd7119486c6ef (diff) | |
download | strongswan-19e0010f51f871f9eb8e3c0b2bc451d7f32e556c.tar.bz2 strongswan-19e0010f51f871f9eb8e3c0b2bc451d7f32e556c.tar.xz |
hashtable enumerator enumerates over both, key and values
Diffstat (limited to 'src/libstrongswan/utils/hashtable.c')
-rw-r--r-- | src/libstrongswan/utils/hashtable.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstrongswan/utils/hashtable.c b/src/libstrongswan/utils/hashtable.c index 22ddeb1f4..974292123 100644 --- a/src/libstrongswan/utils/hashtable.c +++ b/src/libstrongswan/utils/hashtable.c @@ -322,16 +322,18 @@ static u_int get_count(private_hashtable_t *this) /** * Implementation of private_enumerator_t.enumerator.enumerate. */ -static bool enumerate(private_enumerator_t *this, void **item) +static bool enumerate(private_enumerator_t *this, void **key, void **value) { while (this->row < this->table->capacity) { if (this->current) { pair_t *pair; - if (this->current->enumerate(this->current, (void**)&pair)) + + if (this->current->enumerate(this->current, &pair)) { - *item = pair->value; + *key = pair->key; + *value = pair->value; return TRUE; } this->current->destroy(this->current); @@ -340,6 +342,7 @@ static bool enumerate(private_enumerator_t *this, void **item) else { linked_list_t *list; + if ((list = this->table->table[this->row]) != NULL) { this->current = list->create_enumerator(list); |