linked list cleanups

added list methods invoke(), destroy_offset(), destroy_function()
simplified list destruction when destroying its items
This commit is contained in:
Martin Willi
2006-10-24 08:46:17 +00:00
parent 5c4cc9a4e3
commit 55bbff11ec
26 changed files with 312 additions and 551 deletions
+4 -18
View File
@@ -411,24 +411,10 @@ static void get_status(const private_crl_t *this, certinfo_t *certinfo)
*/
static void destroy(private_crl_t *this)
{
revokedCert_t *revokedCert;
identification_t *id;
while (this->revokedCertificates->remove_last(this->revokedCertificates, (void**)&revokedCert) == SUCCESS)
{
free(revokedCert);
}
this->revokedCertificates->destroy(this->revokedCertificates);
while (this->crlDistributionPoints->remove_last(this->crlDistributionPoints, (void**)&id) == SUCCESS)
{
id->destroy(id);
}
this->crlDistributionPoints->destroy(this->crlDistributionPoints);
if (this->issuer)
this->issuer->destroy(this->issuer);
this->revokedCertificates->destroy_function(this->revokedCertificates, free);
this->crlDistributionPoints->destroy_offset(this->crlDistributionPoints,
offsetof(identification_t, destroy));
DESTROY_IF(this->issuer);
free(this->certificateList.ptr);
free(this);
}
+4 -13
View File
@@ -1188,19 +1188,10 @@ static void __attribute__ ((constructor))print_register()
*/
static void destroy(private_x509_t *this)
{
identification_t *id;
while (this->subjectAltNames->remove_last(this->subjectAltNames, (void**)&id) == SUCCESS)
{
id->destroy(id);
}
this->subjectAltNames->destroy(this->subjectAltNames);
while (this->crlDistributionPoints->remove_last(this->crlDistributionPoints, (void**)&id) == SUCCESS)
{
id->destroy(id);
}
this->crlDistributionPoints->destroy(this->crlDistributionPoints);
this->subjectAltNames->destroy_offset(this->subjectAltNames,
offsetof(identification_t, destroy));
this->crlDistributionPoints->destroy_offset(this->crlDistributionPoints,
offsetof(identification_t, destroy));
DESTROY_IF(this->issuer);
DESTROY_IF(this->subject);
DESTROY_IF(this->public_key);