From: Martin Willi Date: Mon, 19 Nov 2012 15:18:50 +0000 (+0100) Subject: Reuse generic constructor in IMV/IMC message X-Git-Tag: 5.0.2dr4~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e45257f7dca842cd9ee2526c2a2b75dda6d9e3f;p=thirdparty%2Fstrongswan.git Reuse generic constructor in IMV/IMC message --- diff --git a/src/libimcv/imc/imc_msg.c b/src/libimcv/imc/imc_msg.c index a03bbc3989..050e63f325 100644 --- a/src/libimcv/imc/imc_msg.c +++ b/src/libimcv/imc/imc_msg.c @@ -447,26 +447,10 @@ imc_msg_t *imc_msg_create_from_long_data(imc_agent_t *agent, imc_state_t *state, { private_imc_msg_t *this; - INIT(this, - .public = { - .get_src_id = _get_src_id, - .get_dst_id = _get_dst_id, - .send = _send_, - .receive = _receive, - .add_attribute = _add_attribute, - .create_attribute_enumerator = _create_attribute_enumerator, - .get_encoding = _get_encoding, - .destroy = _destroy, - }, - .connection_id = connection_id, - .src_id = src_id, - .dst_id = dst_id, - .msg_type = pen_type_create(msg_vid, msg_subtype), - .attr_list = linked_list_create(), - .pa_msg = pa_tnc_msg_create_from_data(msg), - .agent = agent, - .state = state, - ); + this = (private_imc_msg_t*)imc_msg_create(agent, state, + connection_id, src_id, dst_id, + pen_type_create(msg_vid, msg_subtype)); + this->pa_msg = pa_tnc_msg_create_from_data(msg); return &this->public; } diff --git a/src/libimcv/imv/imv_msg.c b/src/libimcv/imv/imv_msg.c index 5555f95b99..81209ce57f 100644 --- a/src/libimcv/imv/imv_msg.c +++ b/src/libimcv/imv/imv_msg.c @@ -426,30 +426,10 @@ imv_msg_t *imv_msg_create_from_long_data(imv_agent_t *agent, imv_state_t *state, { private_imv_msg_t *this; - INIT(this, - .public = { - .get_src_id = _get_src_id, - .get_dst_id = _get_dst_id, - .set_msg_type = _set_msg_type, - .send = _send_, - .send_assessment = _send_assessment, - .receive = _receive, - .add_attribute = _add_attribute, - .delete_attributes = _delete_attributes, - .create_attribute_enumerator = _create_attribute_enumerator, - .get_encoding = _get_encoding, - .destroy = _destroy, - }, - .connection_id = connection_id, - .src_id = src_id, - .dst_id = dst_id, - .msg_type = pen_type_create(msg_vid, msg_subtype), - .attr_list = linked_list_create(), - .pa_msg = pa_tnc_msg_create_from_data(msg), - .agent = agent, - .state = state, - ); + this = (private_imv_msg_t*)imv_msg_create(agent, state, + connection_id, src_id, dst_id, + pen_type_create(msg_vid, msg_subtype)); + this->pa_msg = pa_tnc_msg_create_from_data(msg); return &this->public; } -