Migrated update_sa_job_t to INIT/METHOD macros
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 10 Feb 2011 07:31:46 +0000 (08:31 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 10 Feb 2011 07:31:46 +0000 (08:31 +0100)
src/libcharon/processing/jobs/update_sa_job.c

index a88ce72..3b4e994 100644 (file)
@@ -43,19 +43,15 @@ struct private_update_sa_job_t {
        host_t *new;
 };
 
        host_t *new;
 };
 
-/**
- * Implements job_t.destroy.
- */
-static void destroy(private_update_sa_job_t *this)
+METHOD(job_t, destroy, void,
+       private_update_sa_job_t *this)
 {
        this->new->destroy(this->new);
        free(this);
 }
 
 {
        this->new->destroy(this->new);
        free(this);
 }
 
-/**
- * Implementation of job_t.execute.
- */
-static void execute(private_update_sa_job_t *this)
+METHOD(job_t, execute, void,
+       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);
-
-       this->public.job_interface.execute = (void (*) (job_t *)) execute;
-       this->public.job_interface.destroy = (void (*) (job_t *)) destroy;
-
-       this->reqid = reqid;
-       this->new = new;
+       private_update_sa_job_t *this;
+
+       INIT(this,
+               .public = {
+                       .job_interface = {
+                               .execute = _execute,
+                               .destroy = _destroy,
+                       },
+               },
+               .reqid = reqid,
+               .new = new,
+       );
 
        return &this->public;
 }
 
        return &this->public;
 }