- changed allocation behavior

This commit is contained in:
Martin Willi
2005-11-29 08:08:03 +00:00
parent ed37dee61d
commit df3c59d088
47 changed files with 292 additions and 291 deletions
@@ -1,7 +1,7 @@
/**
* @file initiate_ike_sa_job.c
*
* @brief Job of type INITIATE_IKE_SA
* @brief Implementation of initiate_ike_sa_job_t.
*
*/
@@ -32,7 +32,6 @@ typedef struct private_initiate_ike_sa_job_t private_initiate_ike_sa_job_t;
/**
* Private data of an initiate_ike_sa_job_t Object
*
*/
struct private_initiate_ike_sa_job_t {
/**
@@ -48,8 +47,7 @@ struct private_initiate_ike_sa_job_t {
/**
* Implements initiate_ike_sa_job_t's get_type function.
* See #initiate_ike_sa_job_t.get_type for description.
* Implements initiate_ike_sa_job_t.get_type.
*/
static job_type_t get_type(private_initiate_ike_sa_job_t *this)
{
@@ -57,55 +55,42 @@ static job_type_t get_type(private_initiate_ike_sa_job_t *this)
}
/**
* Implements initiate_ike_sa_job_t's get_configuration_name function.
* See #initiate_ike_sa_job_t.get_configuration_name for description.
* Implements initiate_ike_sa_job_t.get_configuration_name.
*/
static char * get_configuration_name(private_initiate_ike_sa_job_t *this)
static char *get_configuration_name(private_initiate_ike_sa_job_t *this)
{
return this->configuration_name;
}
/**
* Implements job_t's and initiate_ike_sa_job_t's destroy function.
* See #job_t.destroy or #initiate_ike_sa_job_t.destroy for description.
* Implements job_t.destroy.
*/
static status_t destroy(job_t *job)
static void destroy(job_t *job)
{
private_initiate_ike_sa_job_t *this = (private_initiate_ike_sa_job_t *) job;
allocator_free(this->configuration_name);
allocator_free(this);
return SUCCESS;
}
/*
* Described in header
*/
initiate_ike_sa_job_t *initiate_ike_sa_job_create(char *configuration_name)
{
private_initiate_ike_sa_job_t *this = allocator_alloc_thing(private_initiate_ike_sa_job_t);
if ((this == NULL) || (configuration_name == NULL))
{
return NULL;
}
/* interface functions */
this->public.job_interface.get_type = (job_type_t (*) (job_t *)) get_type;
/* same as destroy */
this->public.job_interface.destroy_all = (status_t (*) (job_t *)) destroy;
this->public.job_interface.destroy_all = (void (*) (job_t *)) destroy;
this->public.job_interface.destroy = destroy;
/* public functions */
this->public.get_configuration_name = (char * (*)(initiate_ike_sa_job_t *)) get_configuration_name;
this->public.destroy = (status_t (*)(initiate_ike_sa_job_t *)) destroy;
this->public.destroy = (void (*)(initiate_ike_sa_job_t *)) destroy;
/* private variables */
this->configuration_name = allocator_alloc(strlen(configuration_name) + 1);
if (this->configuration_name == NULL)
{
allocator_free(this);
return NULL;
}
strcpy(this->configuration_name,configuration_name);
return &(this->public);