Migrated storage_t to INIT/METHOD macros.
This commit is contained in:
parent
61ea6e0738
commit
62d4707b20
|
@ -37,10 +37,8 @@ struct private_storage_t {
|
||||||
database_t *db;
|
database_t *db;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(storage_t, login, int,
|
||||||
* Implementation of storage_t.login.
|
private_storage_t *this, char *username, char *password)
|
||||||
*/
|
|
||||||
static int login(private_storage_t *this, char *username, char *password)
|
|
||||||
{
|
{
|
||||||
hasher_t *hasher;
|
hasher_t *hasher;
|
||||||
chunk_t hash, data, hex_str;
|
chunk_t hash, data, hex_str;
|
||||||
|
@ -77,10 +75,8 @@ static int login(private_storage_t *this, char *username, char *password)
|
||||||
return uid;
|
return uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(storage_t, create_gateway_enumerator, enumerator_t*,
|
||||||
* Implementation of storage_t.create_gateway_enumerator.
|
private_storage_t *this, int user)
|
||||||
*/
|
|
||||||
static enumerator_t* create_gateway_enumerator(private_storage_t *this, int user)
|
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
|
|
||||||
|
@ -96,10 +92,8 @@ static enumerator_t* create_gateway_enumerator(private_storage_t *this, int user
|
||||||
return enumerator;
|
return enumerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(storage_t, destroy, void,
|
||||||
* Implementation of storage_t.destroy
|
private_storage_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_storage_t *this)
|
|
||||||
{
|
{
|
||||||
this->db->destroy(this->db);
|
this->db->destroy(this->db);
|
||||||
free(this);
|
free(this);
|
||||||
|
@ -110,13 +104,16 @@ static void destroy(private_storage_t *this)
|
||||||
*/
|
*/
|
||||||
storage_t *storage_create(char *uri)
|
storage_t *storage_create(char *uri)
|
||||||
{
|
{
|
||||||
private_storage_t *this = malloc_thing(private_storage_t);
|
private_storage_t *this;
|
||||||
|
|
||||||
this->public.login = (int(*)(storage_t*, char *username, char *password))login;
|
INIT(this,
|
||||||
this->public.create_gateway_enumerator = (enumerator_t*(*)(storage_t*,int))create_gateway_enumerator;
|
.public = {
|
||||||
this->public.destroy = (void(*)(storage_t*))destroy;
|
.login = _login,
|
||||||
|
.create_gateway_enumerator = _create_gateway_enumerator,
|
||||||
this->db = lib->db->create(lib->db, uri);
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
.db = lib->db->create(lib->db, uri),
|
||||||
|
);
|
||||||
if (this->db == NULL)
|
if (this->db == NULL)
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
|
|
Loading…
Reference in New Issue