osaf/services/saf/amf/amfd/sgproc.cc | 27 ++++++++++-----------------
1 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/osaf/services/saf/amf/amfd/sgproc.cc
b/osaf/services/saf/amf/amfd/sgproc.cc
--- a/osaf/services/saf/amf/amfd/sgproc.cc
+++ b/osaf/services/saf/amf/amfd/sgproc.cc
@@ -907,7 +907,7 @@
{
AVD_DND_MSG *n2d_msg = evt->info.avnd_msg;
AVD_AVND *node;
- AVD_SU *su, *temp_su;
+ AVD_SU *su;
AVD_SU_SI_REL *susi;
bool q_flag = false, qsc_flag = false, all_su_unassigned = true,
all_csi_rem = true;
@@ -1376,8 +1376,7 @@
if (n2d_msg->msg_info.n2d_su_si_assign.error ==
NCSCC_RC_SUCCESS) {
if ((su->sg_of_su->sg_redundancy_model ==
SA_AMF_N_WAY_REDUNDANCY_MODEL) &&
(su->sg_of_su->sg_fsm_state ==
AVD_SG_FSM_STABLE)) {
- for (temp_su =
su->sg_of_su->list_of_su; temp_su != NULL;
- temp_su =
temp_su->sg_list_su_next) {
+ for (const auto& temp_su :
su->sg_of_su->list_of_su) {
temp_su->complete_admin_op(SA_AIS_OK);
}
} else
@@ -1414,7 +1413,7 @@
/* We are checking only application components as on payload
all ncs comp are in no_red model.
We are doing the same thing for controller also. */
- temp_su = node->list_of_su;
+ AVD_SU *temp_su = node->list_of_su;
while (temp_su) {
if (NULL != temp_su->list_of_susi) {
all_su_unassigned = false;
@@ -1524,7 +1523,7 @@
*/
AVD_SU* su_to_instantiate(AVD_SG *sg)
{
- for (AVD_SU* i_su = sg->list_of_su; i_su != NULL; i_su =
i_su->sg_list_su_next) {
+ for (const auto& i_su : sg->list_of_su) {
TRACE("%s", i_su->name.value);
if (i_su->is_instantiable())
return i_su;
@@ -1542,7 +1541,7 @@
{
AmfDb<std::string, AVD_SU> *su_rank = NULL;
su_rank = new AmfDb<std::string, AVD_SU>;
- for (AVD_SU* i_su = sg->list_of_su; i_su != NULL; i_su =
i_su->sg_list_su_next) {
+ for (const auto& i_su : sg->list_of_su) {
TRACE("In Seq %s, %u", i_su->name.value, i_su->saAmfSURank);
su_rank->insert(Amf::to_string(&i_su->name), i_su);
}
@@ -1578,7 +1577,7 @@
{
TRACE_ENTER();
uint32_t in_serv = 0;
- for (AVD_SU* i_su = sg->list_of_su; i_su != NULL; i_su =
i_su->sg_list_su_next) {
+ for (const auto& i_su : sg->list_of_su) {
TRACE_ENTER2("%s", i_su->name.value);
if (i_su->is_in_service()) {
TRACE_ENTER2(" in_serv_su %s", i_su->name.value);
@@ -1618,13 +1617,11 @@
uint32_t num_asgd_su = 0;
uint32_t num_su = 0;
uint32_t num_try_insvc_su = 0;
- AVD_SU *i_su;
AVD_AVND *su_node_ptr = NULL;
TRACE_ENTER2("'%s'", sg->name.value);
- i_su = sg->list_of_su;
- while (i_su != NULL) {
+ for (const auto& i_su : sg->list_of_su) {
su_node_ptr = i_su->get_node_ptr();
num_su++;
/* Check if the SU is inservice */
@@ -1701,9 +1698,6 @@
} else
TRACE("nop for %s", i_su->name.value);
}
- /* else if (i_su->num_of_comp == i_su->curr_num_comp) */
- i_su = i_su->sg_list_su_next;
-
} /* while (i_su != AVD_SU_NULL) */
/* The entire SG has been scanned for reinstatiations and terminations.
@@ -1741,7 +1735,6 @@
uint32_t avd_sg_app_sg_admin_func(AVD_CL_CB *cb, AVD_SG *sg)
{
uint32_t rc = NCSCC_RC_FAILURE;
- AVD_SU *i_su;
TRACE_ENTER2("'%s'", sg->name.value);
@@ -1761,7 +1754,7 @@
* only when AvD is in AVD_APP_STATE. call the SG FSM with the
new readiness
* state.
*/
- for (i_su = sg->list_of_su; i_su != NULL; i_su =
i_su->sg_list_su_next) {
+ for (auto const& i_su : sg->list_of_su) {
if (i_su->is_in_service() == true) {
i_su->set_readiness_state(SA_AMF_READINESS_IN_SERVICE);
}
@@ -1770,7 +1763,7 @@
if (sg->realign(cb, sg) == NCSCC_RC_FAILURE) {
/* set all the SUs to OOS return failure */
- for (i_su = sg->list_of_su; i_su != NULL; i_su =
i_su->sg_list_su_next) {
+ for (auto const& i_su : sg->list_of_su) {
i_su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE);
}
@@ -1788,7 +1781,7 @@
goto done;
}
- for (i_su = sg->list_of_su; i_su != NULL; i_su =
i_su->sg_list_su_next) {
+ for (auto const& i_su : sg->list_of_su) {
i_su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE);
}
break;
------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel