Migrated remaining plugin_t implementations to INIT/METHOD macros

This commit is contained in:
Martin Willi
2011-04-15 10:07:12 +02:00
parent 2b36342551
commit 6e2791715b
18 changed files with 188 additions and 133 deletions
+14 -10
View File
@@ -58,10 +58,8 @@ struct private_uci_plugin_t {
uci_control_t *control;
};
/**
* Implementation of plugin_t.destroy
*/
static void destroy(private_uci_plugin_t *this)
METHOD(plugin_t, destroy, void,
private_uci_plugin_t *this)
{
charon->backends->remove_backend(charon->backends, &this->config->backend);
lib->credmgr->remove_set(lib->credmgr, &this->creds->credential_set);
@@ -77,14 +75,20 @@ static void destroy(private_uci_plugin_t *this)
*/
plugin_t *uci_plugin_create()
{
private_uci_plugin_t *this = malloc_thing(private_uci_plugin_t);
private_uci_plugin_t *this;
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
INIT(this,
.public = {
.plugin = {
.destroy = _destroy,
},
},
.parser = uci_parser_create(UCI_PACKAGE),
.config = uci_config_create(this->parser),
.creds = uci_creds_create(this->parser),
.control = uci_control_create(),
);
this->parser = uci_parser_create(UCI_PACKAGE);
this->config = uci_config_create(this->parser);
this->creds = uci_creds_create(this->parser);
this->control = uci_control_create();
charon->backends->add_backend(charon->backends, &this->config->backend);
lib->credmgr->add_set(lib->credmgr, &this->creds->credential_set);