diff options
author | Tobias Brunner <tobias@strongswan.org> | 2017-05-12 12:10:27 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2017-05-26 13:56:44 +0200 |
commit | 525cc46cabe3dbf17d9f63e76ea9aa974d3665fa (patch) | |
tree | 33c09810e1c86a943c9bbca05ad35900d086362b /src/libstrongswan/crypto/hashers/hash_algorithm_set.c | |
parent | 95a63bf2813cd6ecad912237688526bbcc3481ee (diff) | |
download | strongswan-525cc46cabe3dbf17d9f63e76ea9aa974d3665fa.tar.bz2 strongswan-525cc46cabe3dbf17d9f63e76ea9aa974d3665fa.tar.xz |
Change interface for enumerator_create_filter() callback
This avoids the unportable 5 pointer hack, but requires enumerating in
the callback.
Diffstat (limited to 'src/libstrongswan/crypto/hashers/hash_algorithm_set.c')
-rw-r--r-- | src/libstrongswan/crypto/hashers/hash_algorithm_set.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/libstrongswan/crypto/hashers/hash_algorithm_set.c b/src/libstrongswan/crypto/hashers/hash_algorithm_set.c index 93b67cb13..4087fe1d9 100644 --- a/src/libstrongswan/crypto/hashers/hash_algorithm_set.c +++ b/src/libstrongswan/crypto/hashers/hash_algorithm_set.c @@ -71,17 +71,26 @@ METHOD(hash_algorithm_set_t, count, int, return array_count(this->algorithms); } -static bool hash_filter(void *data, void **in, hash_algorithm_t *out) +CALLBACK(hash_filter, bool, + void *data, enumerator_t *orig, va_list args) { - *out = **(hash_algorithm_t**)in; - return TRUE; + hash_algorithm_t *algo, *out; + + VA_ARGS_VGET(args, out); + + if (orig->enumerate(orig, &algo)) + { + *out = *algo; + return TRUE; + } + return FALSE; } METHOD(hash_algorithm_set_t, create_enumerator, enumerator_t*, private_hash_algorithm_set_t *this) { return enumerator_create_filter(array_create_enumerator(this->algorithms), - (void*)hash_filter, NULL, NULL); + hash_filter, NULL, NULL); } METHOD(hash_algorithm_set_t, destroy, void, |