Migrated acquire_job_t to INIT/METHOD macros

This commit is contained in:
Andreas Steffen
2011-02-10 07:49:05 +01:00
parent f04d1c2dfe
commit be02b8a094
+17 -16
View File
@@ -45,24 +45,20 @@ struct private_acquire_job_t {
traffic_selector_t *dst_ts; traffic_selector_t *dst_ts;
}; };
/** METHOD(job_t, destroy, void,
* Implementation of job_t.destroy. private_acquire_job_t *this)
*/
static void destroy(private_acquire_job_t *this)
{ {
DESTROY_IF(this->src_ts); DESTROY_IF(this->src_ts);
DESTROY_IF(this->dst_ts); DESTROY_IF(this->dst_ts);
free(this); free(this);
} }
/** METHOD(job_t, execute, void,
* Implementation of job_t.execute. private_acquire_job_t *this)
*/
static void execute(private_acquire_job_t *this)
{ {
charon->traps->acquire(charon->traps, this->reqid, charon->traps->acquire(charon->traps, this->reqid,
this->src_ts, this->dst_ts); this->src_ts, this->dst_ts);
destroy(this); _destroy(this);
} }
/* /*
@@ -72,14 +68,19 @@ acquire_job_t *acquire_job_create(u_int32_t reqid,
traffic_selector_t *src_ts, traffic_selector_t *src_ts,
traffic_selector_t *dst_ts) traffic_selector_t *dst_ts)
{ {
private_acquire_job_t *this = malloc_thing(private_acquire_job_t); private_acquire_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->src_ts = src_ts; .destroy = _destroy,
this->dst_ts = dst_ts; },
},
.reqid = reqid,
.src_ts = src_ts,
.dst_ts = dst_ts,
);
return &this->public; return &this->public;
} }