returning reference pointer on get_ref()
This commit is contained in:
@@ -401,9 +401,10 @@ static diffie_hellman_group_t get_dh_group(private_child_cfg_t *this)
|
||||
/**
|
||||
* Implementation of child_cfg_t.get_name
|
||||
*/
|
||||
static void get_ref(private_child_cfg_t *this)
|
||||
static child_cfg_t* get_ref(private_child_cfg_t *this)
|
||||
{
|
||||
ref_get(&this->refcount);
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -448,7 +449,7 @@ child_cfg_t *child_cfg_create(char *name, u_int32_t lifetime,
|
||||
this->public.get_close_action = (action_t (*) (child_cfg_t *))get_close_action;
|
||||
this->public.get_lifetime = (u_int32_t (*) (child_cfg_t *,bool))get_lifetime;
|
||||
this->public.get_dh_group = (diffie_hellman_group_t(*)(child_cfg_t*)) get_dh_group;
|
||||
this->public.get_ref = (void (*) (child_cfg_t*))get_ref;
|
||||
this->public.get_ref = (child_cfg_t* (*) (child_cfg_t*))get_ref;
|
||||
this->public.destroy = (void (*) (child_cfg_t*))destroy;
|
||||
|
||||
this->name = strdup(name);
|
||||
|
||||
@@ -214,15 +214,11 @@ struct child_cfg_t {
|
||||
diffie_hellman_group_t (*get_dh_group)(child_cfg_t *this);
|
||||
|
||||
/**
|
||||
* Get a new reference.
|
||||
* Increase the reference count.
|
||||
*
|
||||
* Get a new reference to this child_cfg by increasing
|
||||
* it's internal reference counter.
|
||||
* Do not call get_ref or any other function until you
|
||||
* already have a reference. Otherwise the object may get
|
||||
* destroyed while calling get_ref(),
|
||||
* @return reference to this
|
||||
*/
|
||||
void (*get_ref) (child_cfg_t *this);
|
||||
child_cfg_t* (*get_ref) (child_cfg_t *this);
|
||||
|
||||
/**
|
||||
* Destroys the child_cfg object.
|
||||
|
||||
@@ -226,9 +226,10 @@ static bool equals(private_ike_cfg_t *this, private_ike_cfg_t *other)
|
||||
/**
|
||||
* Implementation of ike_cfg_t.get_ref.
|
||||
*/
|
||||
static void get_ref(private_ike_cfg_t *this)
|
||||
static ike_cfg_t* get_ref(private_ike_cfg_t *this)
|
||||
{
|
||||
ref_get(&this->refcount);
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -264,7 +265,7 @@ ike_cfg_t *ike_cfg_create(bool certreq, bool force_encap,
|
||||
this->public.select_proposal = (proposal_t*(*)(ike_cfg_t*,linked_list_t*))select_proposal;
|
||||
this->public.get_dh_group = (diffie_hellman_group_t(*)(ike_cfg_t*)) get_dh_group;
|
||||
this->public.equals = (bool(*)(ike_cfg_t*,ike_cfg_t*)) equals;
|
||||
this->public.get_ref = (void(*)(ike_cfg_t*))get_ref;
|
||||
this->public.get_ref = (ike_cfg_t*(*)(ike_cfg_t*))get_ref;
|
||||
this->public.destroy = (void(*)(ike_cfg_t*))destroy;
|
||||
|
||||
/* private variables */
|
||||
|
||||
@@ -113,15 +113,11 @@ struct ike_cfg_t {
|
||||
bool (*equals)(ike_cfg_t *this, ike_cfg_t *other);
|
||||
|
||||
/**
|
||||
* Get a new reference to this ike_cfg.
|
||||
* Increase reference count.
|
||||
*
|
||||
* Get a new reference to this ike_cfg by increasing
|
||||
* it's internal reference counter.
|
||||
* Do not call get_ref or any other function until you
|
||||
* already have a reference. Otherwise the object may get
|
||||
* destroyed while calling get_ref(),
|
||||
* @return reference to this
|
||||
*/
|
||||
void (*get_ref) (ike_cfg_t *this);
|
||||
ike_cfg_t* (*get_ref) (ike_cfg_t *this);
|
||||
|
||||
/**
|
||||
* Destroys a ike_cfg_t object.
|
||||
|
||||
@@ -266,8 +266,7 @@ static child_cfg_t* select_child_cfg(private_peer_cfg_t *this,
|
||||
if (contains_ts(current, TRUE, my_ts, my_host) &&
|
||||
contains_ts(current, FALSE, other_ts, other_host))
|
||||
{
|
||||
found = current;
|
||||
found->get_ref(found);
|
||||
found = current->get_ref(current);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -487,9 +486,10 @@ static bool equals(private_peer_cfg_t *this, private_peer_cfg_t *other)
|
||||
/**
|
||||
* Implements peer_cfg_t.get_ref.
|
||||
*/
|
||||
static void get_ref(private_peer_cfg_t *this)
|
||||
static peer_cfg_t* get_ref(private_peer_cfg_t *this)
|
||||
{
|
||||
ref_get(&this->refcount);
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -556,7 +556,7 @@ peer_cfg_t *peer_cfg_create(char *name, u_int ike_version, ike_cfg_t *ike_cfg,
|
||||
this->public.get_pool = (char*(*)(peer_cfg_t*))get_pool;
|
||||
this->public.get_auth = (auth_info_t*(*)(peer_cfg_t*))get_auth;
|
||||
this->public.equals = (bool(*)(peer_cfg_t*, peer_cfg_t *other))equals;
|
||||
this->public.get_ref = (void(*)(peer_cfg_t *))get_ref;
|
||||
this->public.get_ref = (peer_cfg_t*(*)(peer_cfg_t *))get_ref;
|
||||
this->public.destroy = (void(*)(peer_cfg_t *))destroy;
|
||||
#ifdef ME
|
||||
this->public.is_mediation = (bool (*) (peer_cfg_t *))is_mediation;
|
||||
|
||||
@@ -322,15 +322,11 @@ struct peer_cfg_t {
|
||||
bool (*equals)(peer_cfg_t *this, peer_cfg_t *other);
|
||||
|
||||
/**
|
||||
* Get a new reference.
|
||||
* Increase reference count.
|
||||
*
|
||||
* Get a new reference to this peer_cfg by increasing
|
||||
* it's internal reference counter.
|
||||
* Do not call get_ref or any other function until you
|
||||
* already have a reference. Otherwise the object may get
|
||||
* destroyed while calling get_ref(),
|
||||
* @return reference to this
|
||||
*/
|
||||
void (*get_ref) (peer_cfg_t *this);
|
||||
peer_cfg_t* (*get_ref) (peer_cfg_t *this);
|
||||
|
||||
/**
|
||||
* Destroys the peer_cfg object.
|
||||
|
||||
Reference in New Issue
Block a user