Migrated update_sa_job_t to INIT/METHOD macros

This commit is contained in:
Andreas Steffen
2011-02-10 08:31:46 +01:00
parent 51d6a0d44a
commit 3cd805a115
+15 -14
View File
@@ -43,19 +43,15 @@ struct private_update_sa_job_t {
host_t *new; host_t *new;
}; };
/** METHOD(job_t, destroy, void,
* Implements job_t.destroy. private_update_sa_job_t *this)
*/
static void destroy(private_update_sa_job_t *this)
{ {
this->new->destroy(this->new); this->new->destroy(this->new);
free(this); free(this);
} }
/** METHOD(job_t, execute, void,
* Implementation of job_t.execute. private_update_sa_job_t *this)
*/
static void execute(private_update_sa_job_t *this)
{ {
ike_sa_t *ike_sa; ike_sa_t *ike_sa;
@@ -83,13 +79,18 @@ static void execute(private_update_sa_job_t *this)
*/ */
update_sa_job_t *update_sa_job_create(u_int32_t reqid, host_t *new) update_sa_job_t *update_sa_job_create(u_int32_t reqid, host_t *new)
{ {
private_update_sa_job_t *this = malloc_thing(private_update_sa_job_t); private_update_sa_job_t *this;
this->public.job_interface.execute = (void (*) (job_t *)) execute; INIT(this,
this->public.job_interface.destroy = (void (*) (job_t *)) destroy; .public = {
.job_interface = {
this->reqid = reqid; .execute = _execute,
this->new = new; .destroy = _destroy,
},
},
.reqid = reqid,
.new = new,
);
return &this->public; return &this->public;
} }