]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Migrated rekey_child_sa_job_t to INIT/METHOD macros
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 10 Feb 2011 07:13:01 +0000 (08:13 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 10 Feb 2011 07:13:01 +0000 (08:13 +0100)
src/libcharon/processing/jobs/rekey_child_sa_job.c

index b797d181edd00887c0a58d9611fe14024a609aca..2bcee2ddfd72e07c1006cb2cc0b623d8d2273845 100644 (file)
@@ -45,18 +45,14 @@ struct private_rekey_child_sa_job_t {
        u_int32_t spi;
 };
 
-/**
- * Implementation of job_t.destroy.
- */
-static void destroy(private_rekey_child_sa_job_t *this)
+METHOD(job_t, destroy, void,
+       private_rekey_child_sa_job_t *this)
 {
        free(this);
 }
 
-/**
- * Implementation of job_t.execute.
- */
-static void execute(private_rekey_child_sa_job_t *this)
+METHOD(job_t, execute, void,
+       private_rekey_child_sa_job_t *this)
 {
        ike_sa_t *ike_sa;
 
@@ -82,16 +78,19 @@ rekey_child_sa_job_t *rekey_child_sa_job_create(u_int32_t reqid,
                                                                                                protocol_id_t protocol,
                                                                                                u_int32_t spi)
 {
-       private_rekey_child_sa_job_t *this = malloc_thing(private_rekey_child_sa_job_t);
-
-       /* interface functions */
-       this->public.job_interface.execute = (void (*) (job_t *)) execute;
-       this->public.job_interface.destroy = (void (*)(job_t*)) destroy;
+       private_rekey_child_sa_job_t *this;
 
-       /* private variables */
-       this->reqid = reqid;
-       this->protocol = protocol;
-       this->spi = spi;
+       INIT(this,
+               .public = {
+                       .job_interface = {
+                               .execute = _execute,
+                               .destroy = _destroy,
+                       },
+               },
+               .reqid = reqid,
+               .protocol = protocol,
+               .spi = spi,
+       );
 
        return &this->public;
 }