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

index a47d48e3852367b26fbbfef783fd91a547e07854..b6de4fc0f06fa85a63a47068209feab1f11bc903 100644 (file)
@@ -35,19 +35,15 @@ struct private_process_message_job_t {
        message_t *message;
 };
 
-/**
- * Implements job_t.destroy.
- */
-static void destroy(private_process_message_job_t *this)
+METHOD(job_t, destroy, void,
+       private_process_message_job_t *this)
 {
        this->message->destroy(this->message);
        free(this);
 }
 
-/**
- * Implementation of job_t.execute.
- */
-static void execute(private_process_message_job_t *this)
+METHOD(job_t, execute, void,
+       private_process_message_job_t *this)
 {
        ike_sa_t *ike_sa;
 
@@ -93,14 +89,17 @@ static void execute(private_process_message_job_t *this)
  */
 process_message_job_t *process_message_job_create(message_t *message)
 {
-       private_process_message_job_t *this = malloc_thing(private_process_message_job_t);
-
-       /* interface functions */
-       this->public.job_interface.execute = (void (*) (job_t *)) execute;
-       this->public.job_interface.destroy = (void(*)(job_t*))destroy;
+       private_process_message_job_t *this;
 
-       /* private variables */
-       this->message = message;
+       INIT(this,
+               .public = {
+                       .job_interface = {
+                               .execute = _execute,
+                               .destroy = _destroy,
+                       },
+               },
+               .message = message,
+       );
 
        return &(this->public);
 }