Migrated x509_plugin_t to INIT/METHOD macros
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 4 Dec 2010 09:07:56 +0000 (10:07 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 4 Dec 2010 09:07:56 +0000 (10:07 +0100)
src/libstrongswan/plugins/x509/x509_plugin.c

index 11a7f02..d40cc35 100644 (file)
@@ -36,10 +36,8 @@ struct private_x509_plugin_t {
        x509_plugin_t public;
 };
 
-/**
- * Implementation of x509_plugin_t.x509troy
- */
-static void destroy(private_x509_plugin_t *this)
+METHOD(plugin_t, destroy, void,
+       private_x509_plugin_t *this)
 {
        lib->creds->remove_builder(lib->creds,
                                                           (builder_function_t)x509_cert_gen);
@@ -69,9 +67,15 @@ static void destroy(private_x509_plugin_t *this)
  */
 plugin_t *x509_plugin_create()
 {
-       private_x509_plugin_t *this = malloc_thing(private_x509_plugin_t);
+       private_x509_plugin_t *this;
 
-       this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
+       INIT(this,
+               .public = {
+                       .plugin = {
+                               .destroy = _destroy,
+                       },
+               },
+       );
 
        lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509, FALSE,
                                                        (builder_function_t)x509_cert_gen);