ike-cfg: Allow passing NULL to add_proposal()
This simplifies adding default proposals with constructors potentially returning NULL.
This commit is contained in:
@@ -281,7 +281,10 @@ METHOD(ike_cfg_t, get_dscp, u_int8_t,
|
|||||||
METHOD(ike_cfg_t, add_proposal, void,
|
METHOD(ike_cfg_t, add_proposal, void,
|
||||||
private_ike_cfg_t *this, proposal_t *proposal)
|
private_ike_cfg_t *this, proposal_t *proposal)
|
||||||
{
|
{
|
||||||
this->proposals->insert_last(this->proposals, proposal);
|
if (proposal)
|
||||||
|
{
|
||||||
|
this->proposals->insert_last(this->proposals, proposal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(ike_cfg_t, get_proposals, linked_list_t*,
|
METHOD(ike_cfg_t, get_proposals, linked_list_t*,
|
||||||
|
|||||||
@@ -148,9 +148,10 @@ struct ike_cfg_t {
|
|||||||
* Adds a proposal to the list.
|
* Adds a proposal to the list.
|
||||||
*
|
*
|
||||||
* The first added proposal has the highest priority, the last
|
* The first added proposal has the highest priority, the last
|
||||||
* added the lowest.
|
* added the lowest. It is safe to add NULL as proposal, which has no
|
||||||
|
* effect.
|
||||||
*
|
*
|
||||||
* @param proposal proposal to add
|
* @param proposal proposal to add, or NULL
|
||||||
*/
|
*/
|
||||||
void (*add_proposal) (ike_cfg_t *this, proposal_t *proposal);
|
void (*add_proposal) (ike_cfg_t *this, proposal_t *proposal);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user