Migrated sql_config_t to INIT/METHOD macros

This commit is contained in:
Andreas Steffen
2010-11-30 23:27:51 +01:00
parent cbdcca7fd7
commit e7f586131e
+20 -26
View File
@@ -389,10 +389,8 @@ static peer_cfg_t *build_peer_cfg(private_sql_config_t *this, enumerator_t *e,
return NULL; return NULL;
} }
/** METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
* implements backend_t.get_peer_cfg_by_name. private_sql_config_t *this, char *name)
*/
static peer_cfg_t *get_peer_cfg_by_name(private_sql_config_t *this, char *name)
{ {
enumerator_t *e; enumerator_t *e;
peer_cfg_t *peer_cfg = NULL; peer_cfg_t *peer_cfg = NULL;
@@ -462,11 +460,8 @@ static void ike_enumerator_destroy(ike_enumerator_t *this)
free(this); free(this);
} }
/** METHOD(backend_t, create_ike_cfg_enumerator, enumerator_t*,
* Implementation of backend_t.create_ike_cfg_enumerator. private_sql_config_t *this, host_t *me, host_t *other)
*/
static enumerator_t* create_ike_cfg_enumerator(private_sql_config_t *this,
host_t *me, host_t *other)
{ {
ike_enumerator_t *e = malloc_thing(ike_enumerator_t); ike_enumerator_t *e = malloc_thing(ike_enumerator_t);
@@ -530,12 +525,8 @@ static void peer_enumerator_destroy(peer_enumerator_t *this)
free(this); free(this);
} }
/** METHOD(backend_t, create_peer_cfg_enumerator, enumerator_t*,
* Implementation of backend_t.create_peer_cfg_enumerator. private_sql_config_t *this, identification_t *me, identification_t *other)
*/
static enumerator_t* create_peer_cfg_enumerator(private_sql_config_t *this,
identification_t *me,
identification_t *other)
{ {
peer_enumerator_t *e = malloc_thing(peer_enumerator_t); peer_enumerator_t *e = malloc_thing(peer_enumerator_t);
@@ -572,10 +563,8 @@ static enumerator_t* create_peer_cfg_enumerator(private_sql_config_t *this,
return &e->public; return &e->public;
} }
/** METHOD(sql_config_t, destroy, void,
* Implementation of sql_config_t.destroy. private_sql_config_t *this)
*/
static void destroy(private_sql_config_t *this)
{ {
free(this); free(this);
} }
@@ -585,14 +574,19 @@ static void destroy(private_sql_config_t *this)
*/ */
sql_config_t *sql_config_create(database_t *db) sql_config_t *sql_config_create(database_t *db)
{ {
private_sql_config_t *this = malloc_thing(private_sql_config_t); private_sql_config_t *this;
this->public.backend.create_peer_cfg_enumerator = (enumerator_t*(*)(backend_t*, identification_t *me, identification_t *other))create_peer_cfg_enumerator; INIT(this,
this->public.backend.create_ike_cfg_enumerator = (enumerator_t*(*)(backend_t*, host_t *me, host_t *other))create_ike_cfg_enumerator; .public = {
this->public.backend.get_peer_cfg_by_name = (peer_cfg_t* (*)(backend_t*,char*))get_peer_cfg_by_name; .backend = {
this->public.destroy = (void(*)(sql_config_t*))destroy; .create_peer_cfg_enumerator = _create_peer_cfg_enumerator,
.create_ike_cfg_enumerator = _create_ike_cfg_enumerator,
this->db = db; .get_peer_cfg_by_name = _get_peer_cfg_by_name,
},
.destroy = _destroy,
},
.db = db
);
return &this->public; return &this->public;
} }