Migrated sql_plugin_t to INIT/METHOD macros

This commit is contained in:
Andreas Steffen
2010-11-30 23:31:24 +01:00
parent e7f586131e
commit e79567d07e
+10 -8
View File
@@ -53,10 +53,8 @@ struct private_sql_plugin_t {
sql_logger_t *logger;
};
/**
* Implementation of plugin_t.destroy
*/
static void destroy(private_sql_plugin_t *this)
METHOD(plugin_t, destroy, void,
private_sql_plugin_t *this)
{
charon->backends->remove_backend(charon->backends, &this->config->backend);
lib->credmgr->remove_set(lib->credmgr, &this->cred->set);
@@ -83,11 +81,15 @@ plugin_t *sql_plugin_create()
return NULL;
}
this = malloc_thing(private_sql_plugin_t);
INIT(this,
.public = {
.plugin = {
.destroy = _destroy,
},
},
.db = lib->db->create(lib->db, uri),
);
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
this->db = lib->db->create(lib->db, uri);
if (!this->db)
{
DBG1(DBG_CFG, "sql plugin failed to connect to database");