osaf/services/saf/amf/amfd/csi.cc       |  31 ++++++++++++-------------------
 osaf/services/saf/amf/amfd/include/su.h |   1 +
 osaf/services/saf/amf/amfd/sgproc.cc    |   7 +------
 osaf/services/saf/amf/amfd/su.cc        |  12 ++++++++++++
 4 files changed, 26 insertions(+), 25 deletions(-)


Add and use a method for the task of resetting the assign flag of all the
components of an SU. Preparing for later changing the comp_list implementation.
Removes some code duplication.

diff --git a/osaf/services/saf/amf/amfd/csi.cc 
b/osaf/services/saf/amf/amfd/csi.cc
--- a/osaf/services/saf/amf/amfd/csi.cc
+++ b/osaf/services/saf/amf/amfd/csi.cc
@@ -420,12 +420,12 @@ SaAisErrorT avd_csi_config_get(const SaN
  **************************************************************************/
 static SaAisErrorT csi_ccb_completed_create_hdlr(CcbUtilOperationData_t 
*opdata)
 {
-        SaAisErrorT rc = SA_AIS_ERR_BAD_OPERATION;
+       SaAisErrorT rc = SA_AIS_ERR_BAD_OPERATION;
        SaNameT si_name;
-        AVD_SI *avd_si;
-        AVD_COMP *t_comp;
-        AVD_SU_SI_REL *t_sisu;
-        AVD_COMP_CSI_REL *compcsi;
+       AVD_SI *avd_si;
+       AVD_COMP *t_comp;
+       AVD_SU_SI_REL *t_sisu;
+       AVD_COMP_CSI_REL *compcsi;
        SaNameT cstype_name;
        AVD_COMPCS_TYPE *cst;
 
@@ -459,13 +459,10 @@ static SaAisErrorT csi_ccb_completed_cre
 
                        t_sisu = avd_si->list_of_sisu;
                        while(t_sisu) {
+                               AVD_SU *su = t_sisu->su;
                                /* We need to assign this csi if an extra 
component exists, which is unassigned.*/
-                               /* reset the assign flag */
-                               t_comp = t_sisu->su->list_of_comp;
-                               while (t_comp != NULL) {
-                                       t_comp->assign_flag = false;
-                                       t_comp = t_comp->su_comp_next;
-                               }/* while (t_comp != NULL) */
+
+                               su->reset_all_comps_assign_flag();
 
                                compcsi = t_sisu->list_of_csicomp;
                                while (compcsi != NULL) {
@@ -473,7 +470,7 @@ static SaAisErrorT csi_ccb_completed_cre
                                        compcsi = compcsi->susi_csicomp_next;
                                }
 
-                               t_comp = t_sisu->su->list_of_comp;
+                               t_comp = su->list_of_comp;
                                while (t_comp != NULL) {
                                        if ((t_comp->assign_flag == false) &&
                                                        
(avd_compcstype_find_match(&cstype_name, t_comp) != NULL)) {
@@ -487,7 +484,7 @@ static SaAisErrorT csi_ccb_completed_cre
                                if (NULL == t_comp) {
                                        /* This means that all the components 
are assigned, let us assigned it to assigned 
                                           component.*/
-                                       t_comp = t_sisu->su->list_of_comp;
+                                       t_comp = su->list_of_comp;
                                        while (t_comp != NULL) {
                                                if (NULL != (cst = 
avd_compcstype_find_match(&cstype_name, t_comp))) {
                                                        if (SA_AMF_HA_ACTIVE == 
t_sisu->state) {
@@ -848,12 +845,8 @@ static void csi_ccb_apply_create_hdlr(st
                t_sisu = csi->si->list_of_sisu;
                while(t_sisu) {
                        /* We need to assign this csi if an extra component 
exists, which is unassigned.*/
-                       /* reset the assign flag */
-                       t_comp = t_sisu->su->list_of_comp;
-                       while (t_comp != NULL) {
-                               t_comp->assign_flag = false;
-                               t_comp = t_comp->su_comp_next;
-                       }/* while (t_comp != NULL) */
+
+                       t_sisu->su->reset_all_comps_assign_flag();
 
                        compcsi = t_sisu->list_of_csicomp;
                        while (compcsi != NULL) {
diff --git a/osaf/services/saf/amf/amfd/include/su.h 
b/osaf/services/saf/amf/amfd/include/su.h
--- a/osaf/services/saf/amf/amfd/include/su.h
+++ b/osaf/services/saf/amf/amfd/include/su.h
@@ -118,6 +118,7 @@ class AVD_SU {
        void set_su_switch(SaToggleState state);
        avd_avnd_tag *get_node_ptr(void);
        bool is_in_service(void);
+       void reset_all_comps_assign_flag();
 
  private:
        void send_attribute_update(AVSV_AMF_SU_ATTR_ID attrib_id);
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
@@ -90,12 +90,7 @@ uint32_t avd_new_assgn_susi(AVD_CL_CB *c
                l_csi = l_csi->si_list_of_csi_next;
        }
 
-       /* reset the assign flag */
-       l_comp = su->list_of_comp;
-       while (l_comp != NULL) {
-               l_comp->assign_flag = false;
-               l_comp = l_comp->su_comp_next;
-       }
+       su->reset_all_comps_assign_flag();
 
        l_csi = si->list_of_csi;
        while (l_csi != NULL) {
diff --git a/osaf/services/saf/amf/amfd/su.cc b/osaf/services/saf/amf/amfd/su.cc
--- a/osaf/services/saf/amf/amfd/su.cc
+++ b/osaf/services/saf/amf/amfd/su.cc
@@ -1781,3 +1781,15 @@ void AVD_SU::set_saAmfSUPreInstantiable(
                        SA_IMM_ATTR_SAUINT32T, &saAmfSUPreInstantiable);
        TRACE("%s saAmfSUPreInstantiable %u", name.value, value);
 }
+
+/**
+ * resets the assign flag for all contained components
+ */
+void AVD_SU::reset_all_comps_assign_flag() {
+       AVD_COMP *t_comp = list_of_comp;
+       // TODO(hafe) add and use a comp method
+       while (t_comp != NULL) {
+               t_comp->assign_flag = false;
+               t_comp = t_comp->su_comp_next;
+       }
+}

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to