aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2010-12-04 10:48:42 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2010-12-04 10:48:42 +0100
commit72c436c170d198b879e2c818383d03ff185c2ed6 (patch)
treea6edc8e76dd49c113ca1c168fdb3df45558be8b7
parent4d7e8032ecfd083e05d666ed849087defb4f22b8 (diff)
downloadstrongswan-72c436c170d198b879e2c818383d03ff185c2ed6.tar.bz2
strongswan-72c436c170d198b879e2c818383d03ff185c2ed6.tar.xz
Migrated sha2_plugin_t to INIT/METHOD macros
-rw-r--r--src/libstrongswan/plugins/sha2/sha2_plugin.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/libstrongswan/plugins/sha2/sha2_plugin.c b/src/libstrongswan/plugins/sha2/sha2_plugin.c
index 810d9922a..dbb3c3f3b 100644
--- a/src/libstrongswan/plugins/sha2/sha2_plugin.c
+++ b/src/libstrongswan/plugins/sha2/sha2_plugin.c
@@ -31,10 +31,8 @@ struct private_sha2_plugin_t {
sha2_plugin_t public;
};
-/**
- * Implementation of sha2_plugin_t.destroy
- */
-static void destroy(private_sha2_plugin_t *this)
+METHOD(plugin_t, destroy, void,
+ private_sha2_plugin_t *this)
{
lib->crypto->remove_hasher(lib->crypto,
(hasher_constructor_t)sha2_hasher_create);
@@ -46,9 +44,15 @@ static void destroy(private_sha2_plugin_t *this)
*/
plugin_t *sha2_plugin_create()
{
- private_sha2_plugin_t *this = malloc_thing(private_sha2_plugin_t);
+ private_sha2_plugin_t *this;
- this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
+ INIT(this,
+ .public = {
+ .plugin = {
+ .destroy = _destroy,
+ },
+ },
+ );
lib->crypto->add_hasher(lib->crypto, HASH_SHA224,
(hasher_constructor_t)sha2_hasher_create);