aboutsummaryrefslogtreecommitdiffstats
path: root/src/medsrv/user.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2011-10-04 10:45:05 +0200
committerTobias Brunner <tobias@strongswan.org>2011-10-04 10:45:05 +0200
commitacf058251d0a673cf179221ad0b506ae3cc97c61 (patch)
treeb8fac5d9f551ef0a8414ea67a50ce02fef735533 /src/medsrv/user.c
parent06a04c3ca43739d5ac78343a9f8004e5f5913bc7 (diff)
downloadstrongswan-acf058251d0a673cf179221ad0b506ae3cc97c61.tar.bz2
strongswan-acf058251d0a673cf179221ad0b506ae3cc97c61.tar.xz
Migrated user_t to INIT/METHOD macros.
Diffstat (limited to 'src/medsrv/user.c')
-rw-r--r--src/medsrv/user.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/medsrv/user.c b/src/medsrv/user.c
index d204dd057..b4859080b 100644
--- a/src/medsrv/user.c
+++ b/src/medsrv/user.c
@@ -33,26 +33,20 @@ struct private_user_t {
u_int user;
};
-/**
- * Implementation of user_t.set_user
- */
-static void set_user(private_user_t *this, u_int id)
+METHOD(user_t, set_user, void,
+ private_user_t *this, u_int id)
{
this->user = id;
}
-/**
- * Implementation of user_t.get_user
- */
-static u_int get_user(private_user_t *this)
+METHOD(user_t, get_user, u_int,
+ private_user_t *this)
{
return this->user;
}
-/**
- * Implementation of context_t.destroy
- */
-static void destroy(private_user_t *this)
+METHOD(context_t, destroy, void,
+ private_user_t *this)
{
free(this);
}
@@ -62,13 +56,17 @@ static void destroy(private_user_t *this)
*/
user_t *user_create(void *param)
{
- private_user_t *this= malloc_thing(private_user_t);
-
- this->public.set_user = (void(*)(user_t*,u_int id))set_user;
- this->public.get_user = (u_int(*)(user_t*))get_user;
- this->public.context.destroy = (void(*)(context_t*))destroy;
+ private_user_t *this;
- this->user = 0;
+ INIT(this,
+ .public = {
+ .set_user = _set_user,
+ .get_user = _get_user,
+ .context = {
+ .destroy = _destroy,
+ },
+ },
+ );
return &this->public;
}