Migrated kernel_pfroute_plugin_t to INIT/METHOD macros
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 25 Nov 2010 22:17:18 +0000 (23:17 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 25 Nov 2010 22:17:18 +0000 (23:17 +0100)
src/libhydra/plugins/kernel_pfroute/kernel_pfroute_plugin.c

index 5f351bd..a4cb53e 100644 (file)
@@ -32,10 +32,8 @@ struct private_kernel_pfroute_plugin_t {
        kernel_pfroute_plugin_t public;
 };
 
-/**
- * Implementation of plugin_t.destroy
- */
-static void destroy(private_kernel_pfroute_plugin_t *this)
+METHOD(plugin_t, destroy, void,
+       private_kernel_pfroute_plugin_t *this)
 {
        hydra->kernel_interface->remove_net_interface(hydra->kernel_interface,
                                                (kernel_net_constructor_t)kernel_pfroute_net_create);
@@ -47,10 +45,15 @@ static void destroy(private_kernel_pfroute_plugin_t *this)
  */
 plugin_t *kernel_pfroute_plugin_create()
 {
-       private_kernel_pfroute_plugin_t *this = malloc_thing(private_kernel_pfroute_plugin_t);
-
-       this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
-
+       private_kernel_pfroute_plugin_t *this;
+
+       INIT(this,
+               .public = {
+                       .plugin = {
+                               .destroy = _destroy,
+                       },
+               },
+       );
        hydra->kernel_interface->add_net_interface(hydra->kernel_interface,
                                                (kernel_net_constructor_t)kernel_pfroute_net_create);