Migrated user_t to INIT/METHOD macros.
This commit is contained in:
+16
-18
@@ -33,26 +33,20 @@ struct private_user_t {
|
|||||||
u_int user;
|
u_int user;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(user_t, set_user, void,
|
||||||
* Implementation of user_t.set_user
|
private_user_t *this, u_int id)
|
||||||
*/
|
|
||||||
static void set_user(private_user_t *this, u_int id)
|
|
||||||
{
|
{
|
||||||
this->user = id;
|
this->user = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(user_t, get_user, u_int,
|
||||||
* Implementation of user_t.get_user
|
private_user_t *this)
|
||||||
*/
|
|
||||||
static u_int get_user(private_user_t *this)
|
|
||||||
{
|
{
|
||||||
return this->user;
|
return this->user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(context_t, destroy, void,
|
||||||
* Implementation of context_t.destroy
|
private_user_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_user_t *this)
|
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
@@ -62,13 +56,17 @@ static void destroy(private_user_t *this)
|
|||||||
*/
|
*/
|
||||||
user_t *user_create(void *param)
|
user_t *user_create(void *param)
|
||||||
{
|
{
|
||||||
private_user_t *this= malloc_thing(private_user_t);
|
private_user_t *this;
|
||||||
|
|
||||||
this->public.set_user = (void(*)(user_t*,u_int id))set_user;
|
INIT(this,
|
||||||
this->public.get_user = (u_int(*)(user_t*))get_user;
|
.public = {
|
||||||
this->public.context.destroy = (void(*)(context_t*))destroy;
|
.set_user = _set_user,
|
||||||
|
.get_user = _get_user,
|
||||||
this->user = 0;
|
.context = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user