linked-list: Change return value of find_first() and signature of its callback

This avoids the unportable five pointer hack.
This commit is contained in:
Tobias Brunner
2017-05-26 13:56:44 +02:00
parent 8a2e4d4a8b
commit 2e4d110d1e
29 changed files with 526 additions and 398 deletions
+7 -8
View File
@@ -358,11 +358,12 @@ METHOD(credential_set_t, create_cdp_enumerator, enumerator_t*,
data, (void*)cdp_data_destroy);
}
/**
* Compare the given certificate to the ca_cert_t items in the list
*/
static bool match_cert(ca_cert_t *item, certificate_t *cert)
CALLBACK(match_cert, bool,
ca_cert_t *item, va_list args)
{
certificate_t *cert;
VA_ARGS_VGET(args, cert);
return cert->equals(cert, item->cert);
}
@@ -409,8 +410,7 @@ static certificate_t *add_cert_internal(private_stroke_ca_t *this,
{
ca_cert_t *found;
if (this->certs->find_first(this->certs, (linked_list_match_t)match_cert,
(void**)&found, cert) == SUCCESS)
if (this->certs->find_first(this->certs, match_cert, (void**)&found, cert))
{
cert->destroy(cert);
cert = found->cert->get_ref(found->cert);
@@ -515,8 +515,7 @@ METHOD(stroke_ca_t, get_cert_ref, certificate_t*,
ca_cert_t *found;
this->lock->read_lock(this->lock);
if (this->certs->find_first(this->certs, (linked_list_match_t)match_cert,
(void**)&found, cert) == SUCCESS)
if (this->certs->find_first(this->certs, match_cert, (void**)&found, cert))
{
cert->destroy(cert);
cert = found->cert->get_ref(found->cert);
+1 -2
View File
@@ -958,8 +958,7 @@ static void list_plugins(FILE *out)
{
case FEATURE_PROVIDE:
fp = &features[i];
loaded = list->find_first(list, NULL,
(void**)&fp) == SUCCESS;
loaded = list->find_first(list, NULL, (void**)&fp);
fprintf(out, " %s%s\n",
str, loaded ? "" : " (not loaded)");
break;