diff options
author | Tobias Brunner <tobias@strongswan.org> | 2017-05-16 12:11:24 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2017-05-26 13:56:44 +0200 |
commit | 2e4d110d1e94a3be9da06894832492ff469eec37 (patch) | |
tree | db62e4fcd1a955b5179c6f172a9403500bb24e50 /src/libstrongswan/credentials/sets/mem_cred.c | |
parent | 8a2e4d4a8b87f5e8a5e5f663ee8eddd47988fa2c (diff) | |
download | strongswan-2e4d110d1e94a3be9da06894832492ff469eec37.tar.bz2 strongswan-2e4d110d1e94a3be9da06894832492ff469eec37.tar.xz |
linked-list: Change return value of find_first() and signature of its callback
This avoids the unportable five pointer hack.
Diffstat (limited to 'src/libstrongswan/credentials/sets/mem_cred.c')
-rw-r--r-- | src/libstrongswan/credentials/sets/mem_cred.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/libstrongswan/credentials/sets/mem_cred.c b/src/libstrongswan/credentials/sets/mem_cred.c index 7576220bc..4d594e439 100644 --- a/src/libstrongswan/credentials/sets/mem_cred.c +++ b/src/libstrongswan/credentials/sets/mem_cred.c @@ -149,8 +149,12 @@ METHOD(credential_set_t, create_cert_enumerator, enumerator_t*, cert_data_destroy); } -static bool certificate_equals(certificate_t *item, certificate_t *cert) +CALLBACK(certificate_equals, bool, + certificate_t *item, va_list args) { + certificate_t *cert; + + VA_ARGS_VGET(args, cert); return item->equals(item, cert); } @@ -163,9 +167,8 @@ static certificate_t *add_cert_internal(private_mem_cred_t *this, bool trusted, { certificate_t *cached; this->lock->write_lock(this->lock); - if (this->untrusted->find_first(this->untrusted, - (linked_list_match_t)certificate_equals, - (void**)&cached, cert) == SUCCESS) + if (this->untrusted->find_first(this->untrusted, certificate_equals, + (void**)&cached, cert)) { cert->destroy(cert); cert = cached->get_ref(cached); @@ -201,9 +204,8 @@ METHOD(mem_cred_t, get_cert_ref, certificate_t*, certificate_t *cached; this->lock->read_lock(this->lock); - if (this->untrusted->find_first(this->untrusted, - (linked_list_match_t)certificate_equals, - (void**)&cached, cert) == SUCCESS) + if (this->untrusted->find_first(this->untrusted, certificate_equals, + (void**)&cached, cert)) { cert->destroy(cert); cert = cached->get_ref(cached); |