Migrated kernel_netlink_plugin_t to INIT/METHOD macros
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 25 Nov 2010 22:12:12 +0000 (23:12 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 25 Nov 2010 22:12:12 +0000 (23:12 +0100)
src/libhydra/plugins/kernel_netlink/kernel_netlink_plugin.c

index 212675d..9fc1a03 100644 (file)
@@ -33,10 +33,8 @@ struct private_kernel_netlink_plugin_t {
        kernel_netlink_plugin_t public;
 };
 
-/**
- * Implementation of plugin_t.destroy
- */
-static void destroy(private_kernel_netlink_plugin_t *this)
+METHOD(plugin_t, destroy, void,
+       private_kernel_netlink_plugin_t *this)
 {
        hydra->kernel_interface->remove_ipsec_interface(hydra->kernel_interface,
                                        (kernel_ipsec_constructor_t)kernel_netlink_ipsec_create);
@@ -50,10 +48,15 @@ static void destroy(private_kernel_netlink_plugin_t *this)
  */
 plugin_t *kernel_netlink_plugin_create()
 {
-       private_kernel_netlink_plugin_t *this = malloc_thing(private_kernel_netlink_plugin_t);
-
-       this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
+       private_kernel_netlink_plugin_t *this;
 
+       INIT(this,
+               .public = {
+                       .plugin = {
+                               .destroy = _destroy,
+                       },
+               },
+       );
        hydra->kernel_interface->add_ipsec_interface(hydra->kernel_interface,
                                        (kernel_ipsec_constructor_t)kernel_netlink_ipsec_create);
        hydra->kernel_interface->add_net_interface(hydra->kernel_interface,