Migrated attr_plugin_t to INIT/METHOD macros
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 25 Nov 2010 21:52:32 +0000 (22:52 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 25 Nov 2010 21:52:32 +0000 (22:52 +0100)
src/libhydra/plugins/attr/attr_plugin.c

index 24c00bb..a1d182b 100644 (file)
@@ -36,10 +36,8 @@ struct private_attr_plugin_t {
        attr_provider_t *provider;
 };
 
-/**
- * Implementation of plugin_t.destroy
- */
-static void destroy(private_attr_plugin_t *this)
+METHOD(plugin_t, destroy, void,
+       private_attr_plugin_t *this)
 {
        hydra->attributes->remove_provider(hydra->attributes, &this->provider->provider);
        this->provider->destroy(this->provider);
@@ -53,9 +51,14 @@ plugin_t *attr_plugin_create()
 {
        private_attr_plugin_t *this = malloc_thing(private_attr_plugin_t);
 
-       this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
-
-       this->provider = attr_provider_create();
+       INIT(this,
+               .public = {
+                       .plugin = {
+                               .destroy = _destroy,
+                       },
+               },
+               .provider = attr_provider_create()
+       );
        hydra->attributes->add_provider(hydra->attributes, &this->provider->provider);
 
        return &this->public.plugin;