Migrated config_controller_t to INIT/METHOD macros.

This commit is contained in:
Tobias Brunner
2011-10-04 11:31:31 +02:00
parent 4ad6b41a07
commit cd27d66788
+18 -19
View File
@@ -149,19 +149,15 @@ static void list(private_config_controller_t *this, request_t *r)
}
}
/**
* Implementation of controller_t.get_name
*/
static char* get_name(private_config_controller_t *this)
METHOD(controller_t, get_name, char*,
private_config_controller_t *this)
{
return "config";
}
/**
* Implementation of controller_t.handle
*/
static void handle(private_config_controller_t *this,
request_t *request, char *action)
METHOD(controller_t, handle, void,
private_config_controller_t *this, request_t *request, char *action,
char *p2, char *p3, char *p4, char *p5)
{
if (!this->manager->logged_in(this->manager))
{
@@ -181,10 +177,8 @@ static void handle(private_config_controller_t *this,
return request->redirect(request, "config/list");
}
/**
* Implementation of controller_t.destroy
*/
static void destroy(private_config_controller_t *this)
METHOD(controller_t, destroy, void,
private_config_controller_t *this)
{
free(this);
}
@@ -194,13 +188,18 @@ static void destroy(private_config_controller_t *this)
*/
controller_t *config_controller_create(context_t *context, void *param)
{
private_config_controller_t *this = malloc_thing(private_config_controller_t);
private_config_controller_t *this;
this->public.controller.get_name = (char*(*)(controller_t*))get_name;
this->public.controller.handle = (void(*)(controller_t*,request_t*,char*,char*,char*,char*,char*))handle;
this->public.controller.destroy = (void(*)(controller_t*))destroy;
this->manager = (manager_t*)context;
INIT(this,
.public = {
.controller = {
.get_name = _get_name,
.handle = _handle,
.destroy = _destroy,
},
},
.manager = (manager_t*)context,
);
return &this->public.controller;
}