aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/encoding/payloads/proposal_substructure.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2006-10-24 08:46:17 +0000
committerMartin Willi <martin@strongswan.org>2006-10-24 08:46:17 +0000
commit55bbff11ec96f74b27afc36dd8ca3e34ff425b40 (patch)
tree9d0ff1aad70e01718405a8da314d22a86b072947 /src/charon/encoding/payloads/proposal_substructure.c
parent5c4cc9a4e328d86867959dec0e082f7e4f098a6e (diff)
downloadstrongswan-55bbff11ec96f74b27afc36dd8ca3e34ff425b40.tar.bz2
strongswan-55bbff11ec96f74b27afc36dd8ca3e34ff425b40.tar.xz
linked list cleanups
added list methods invoke(), destroy_offset(), destroy_function() simplified list destruction when destroying its items
Diffstat (limited to 'src/charon/encoding/payloads/proposal_substructure.c')
-rw-r--r--src/charon/encoding/payloads/proposal_substructure.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/charon/encoding/payloads/proposal_substructure.c b/src/charon/encoding/payloads/proposal_substructure.c
index 58c1dd29b..5842f6e8b 100644
--- a/src/charon/encoding/payloads/proposal_substructure.c
+++ b/src/charon/encoding/payloads/proposal_substructure.c
@@ -472,28 +472,12 @@ static private_proposal_substructure_t* clone_(private_proposal_substructure_t *
* Implements payload_t's and proposal_substructure_t's destroy function.
* See #payload_s.destroy or proposal_substructure_s.destroy for description.
*/
-static status_t destroy(private_proposal_substructure_t *this)
+static void destroy(private_proposal_substructure_t *this)
{
- /* all proposals are getting destroyed */
- while (this->transforms->get_count(this->transforms) > 0)
- {
- transform_substructure_t *current_transform;
- if (this->transforms->remove_last(this->transforms,(void **)&current_transform) != SUCCESS)
- {
- break;
- }
- current_transform->destroy(current_transform);
- }
- this->transforms->destroy(this->transforms);
-
- if (this->spi.ptr != NULL)
- {
- free(this->spi.ptr);
- }
-
+ this->transforms->destroy_offset(this->transforms,
+ offsetof(transform_substructure_t, destroy));
+ chunk_free(&this->spi);
free(this);
-
- return SUCCESS;
}
/*