src/amf/amfd/app.cc            |   3 +-
 src/amf/amfd/apptype.cc        |   9 +----
 src/amf/amfd/chkop.cc          |   3 +-
 src/amf/amfd/ckpt_dec.cc       |  15 +++----
 src/amf/amfd/ckpt_edu.cc       |   3 +-
 src/amf/amfd/ckpt_enc.cc       |  60 ++++++++++++-------------------
 src/amf/amfd/clm.cc            |   5 +-
 src/amf/amfd/cluster.cc        |  16 +++-----
 src/amf/amfd/comp.cc           |  11 ++---
 src/amf/amfd/compcstype.cc     |   7 +--
 src/amf/amfd/comptype.cc       |   3 +-
 src/amf/amfd/csi.cc            |  23 ++++-------
 src/amf/amfd/csiattr.cc        |   9 +---
 src/amf/amfd/ctcstype.cc       |  10 +----
 src/amf/amfd/dmsg.cc           |   4 +-
 src/amf/amfd/hlttype.cc        |   3 +-
 src/amf/amfd/imm.cc            |  49 ++++++++++---------------
 src/amf/amfd/main.cc           |  19 ++-------
 src/amf/amfd/mds.cc            |   4 +-
 src/amf/amfd/ndfsm.cc          |  35 +++++++-----------
 src/amf/amfd/ndproc.cc         |  15 ++-----
 src/amf/amfd/node.cc           |  24 ++++-------
 src/amf/amfd/nodegroup.cc      |  10 ++---
 src/amf/amfd/role.cc           |  42 ++++++++-------------
 src/amf/amfd/sg.cc             |  23 ++---------
 src/amf/amfd/sg_2n_fsm.cc      |  10 ++--
 src/amf/amfd/sg_nored_fsm.cc   |   3 +-
 src/amf/amfd/sg_npm_fsm.cc     |  33 ++++++----------
 src/amf/amfd/sg_nway_fsm.cc    |  39 +++++++-------------
 src/amf/amfd/sg_nwayact_fsm.cc |   5 +-
 src/amf/amfd/sgproc.cc         |  16 ++-----
 src/amf/amfd/sgtype.cc         |   3 +-
 src/amf/amfd/si.cc             |  24 ++++--------
 src/amf/amfd/si_dep.cc         |  79 ++++++++++++++---------------------------
 src/amf/amfd/siass.cc          |  18 +++-----
 src/amf/amfd/sirankedsu.cc     |  17 +++-----
 src/amf/amfd/su.cc             |   8 +--
 src/amf/amfd/sutype.cc         |   6 ---
 src/amf/amfd/util.cc           |  69 +++++++++++++----------------------
 39 files changed, 260 insertions(+), 475 deletions(-)


[staging/src/amf/amfd/app.cc:285]: (style) The scope of the variable 'i' can be 
reduced.
[staging/src/amf/amfd/apptype.cc:137]: (style) Condition 'rc!=0' is always false
[staging/src/amf/amfd/apptype.cc:69]: (style) The scope of the variable 
'sg_type' can be reduced.
[staging/src/amf/amfd/chkop.cc:1297] -> [staging/src/amf/amfd/chkop.cc:1302]: 
(style) Variable 'uba' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_dec.cc:374] -> 
[staging/src/amf/amfd/ckpt_dec.cc:382]: (style) Variable 'status' is reassigned 
a value before the old one has been used.
[staging/src/amf/amfd/ckpt_dec.cc:573] -> 
[staging/src/amf/amfd/ckpt_dec.cc:577]: (style) Variable 'status' is reassigned 
a value before the old one has been used.
[staging/src/amf/amfd/ckpt_dec.cc:1109]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_edu.cc:51] -> [staging/src/amf/amfd/ckpt_edu.cc:56]: 
(style) Variable 'rc' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_enc.cc:2281] -> 
[staging/src/amf/amfd/ckpt_enc.cc:2288]: (style) Variable 'status' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_enc.cc:2314] -> 
[staging/src/amf/amfd/ckpt_enc.cc:2322]: (style) Variable 'status' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_enc.cc:1951]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:1982]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2015]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2044]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2076]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2111]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2151]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2176]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2216]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2252]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2470]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/clm.cc:344]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/cluster.cc:82]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/cluster.cc:95]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/cluster.cc:116]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/comp.cc:1270] -> [staging/src/amf/amfd/comp.cc:1285]: 
(style) Variable 'su_node_ptr' is reassigned a value before the old one has 
been used.
[staging/src/amf/amfd/comp.cc:49]: (style) The scope of the variable 'rc' can 
be reduced.
[staging/src/amf/amfd/comp.cc:947]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/compcstype.cc:92] -> 
[staging/src/amf/amfd/compcstype.cc:99]: (style) Variable 'cst' is reassigned a 
value before the old one has been used.
[staging/src/amf/amfd/compcstype.cc:46]: (style) The scope of the variable 'rc' 
can be reduced.
[staging/src/amf/amfd/comptype.cc:417]: (style) The scope of the variable 'i' 
can be reduced.
[staging/src/amf/amfd/csi.cc:626]: (warning) Comparison of a boolean expression 
with an integer.
[staging/src/amf/amfd/csi.cc:1418] -> [staging/src/amf/amfd/csi.cc:1410]: 
(warning) Either the condition 'ptr!=nullptr' is redundant or there is possible 
null pointer dereference: ptr.
[staging/src/amf/amfd/csi.cc:921] -> [staging/src/amf/amfd/csi.cc:925]: (style) 
Variable 'csi' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/csi.cc:1370] -> [staging/src/amf/amfd/csi.cc:1375]: 
(style) Variable 'i_attr' is reassigned a value before the old one has been 
used.
[staging/src/amf/amfd/csi.cc:1491]: (style) The scope of the variable 'susi' 
can be reduced.
[staging/src/amf/amfd/csi.cc:1492]: (style) The scope of the variable 'si' can 
be reduced.
[staging/src/amf/amfd/csiattr.cc:541]: (style) The scope of the variable 
'attribute' can be reduced.
[staging/src/amf/amfd/ctcstype.cc:120]: (style) Condition 'rc!=0' is always 
false
[staging/src/amf/amfd/ctcstype.cc:231] -> 
[staging/src/amf/amfd/ctcstype.cc:234]: (style) Variable 'ctcs_type' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/dmsg.cc:236]: (warning) Assignment of function parameter 
has no effect outside the function. Did you forget dereferencing it?
[staging/src/amf/amfd/dmsg.cc:61] -> [staging/src/amf/amfd/dmsg.cc:66]: (style) 
Variable 'uba' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/hlttype.cc:64]: (style) The scope of the variable 'i' can 
be reduced.
[staging/src/amf/amfd/imm.cc:1122] -> [staging/src/amf/amfd/imm.cc:1128]: 
(style) Variable 'temp' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/imm.cc:2299] -> [staging/src/amf/amfd/imm.cc:2300]: 
(style) Variable 'su' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/imm.cc:2354] -> [staging/src/amf/amfd/imm.cc:2359]: 
(style) Variable 'csi' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/imm.cc:2355] -> [staging/src/amf/amfd/imm.cc:2360]: 
(style) Variable 'comp' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/imm.cc:2387] -> [staging/src/amf/amfd/imm.cc:2388]: 
(style) Variable 'comp' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/imm.cc:2478] -> [staging/src/amf/amfd/imm.cc:2487]: 
(style) Variable 'csi' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/imm.cc:2479] -> [staging/src/amf/amfd/imm.cc:2488]: 
(style) Variable 'comp' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/imm.cc:1644]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/imm.cc:1891]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/imm.cc:1916]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/imm.cc:1934]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/imm.cc:1942]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/main.cc:257]: (style) The scope of the variable 'n2d_msg' 
can be reduced.
[staging/src/amf/amfd/main.cc:290]: (style) The scope of the variable 'n2d_msg' 
can be reduced.
[staging/src/amf/amfd/main.cc:323]: (style) The scope of the variable 'n2d_msg' 
can be reduced.
[staging/src/amf/amfd/main.cc:405]: (style) The scope of the variable 
'queue_evt' can be reduced.
[staging/src/amf/amfd/main.cc:429]: (style) The scope of the variable 
'fover_done' can be reduced.
[staging/src/amf/amfd/mds.cc:505] -> [staging/src/amf/amfd/mds.cc:510]: (style) 
Variable 'evt' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/ndfsm.cc:116]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ndfsm.cc:125]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ndfsm.cc:177]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ndfsm.cc:225]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ndfsm.cc:741]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ndfsm.cc:777]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ndfsm.cc:865]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ndproc.cc:1101] -> [staging/src/amf/amfd/ndproc.cc:1103]: 
(style) Variable 'valid_info' is reassigned a value before the old one has been 
used.
[staging/src/amf/amfd/ndproc.cc:317]: (style) The scope of the variable 
'state_info_evt' can be reduced.
[staging/src/amf/amfd/ndproc.cc:361]: (style) The scope of the variable 
'state_info_evt' can be reduced.
[staging/src/amf/amfd/ndproc.cc:735]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/node.cc:49]: (style) The scope of the variable 'rc' can 
be reduced.
[staging/src/amf/amfd/node.cc:68]: (style) The scope of the variable 'rc' can 
be reduced.
[staging/src/amf/amfd/node.cc:200]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/node.cc:582]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/node.cc:1555]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/node.cc:1571]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/nodegroup.cc:224]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/nodegroup.cc:1407]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/role.cc:855] -> [staging/src/amf/amfd/role.cc:864]: 
(style) Variable 'avnd' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/role.cc:903] -> [staging/src/amf/amfd/role.cc:914]: 
(style) Variable 'rc' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/role.cc:695]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/role.cc:709]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/role.cc:716]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/role.cc:722]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/role.cc:729]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/role.cc:1124]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/role.cc:1277]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/sg.cc:640]: (warning) Comparison of a boolean expression 
with an integer.
[staging/src/amf/amfd/sg.cc:640]: (warning) Comparison of a boolean value using 
relational operator (<, >, <= or >=).
[staging/src/amf/amfd/sg.cc:929]: (style) Expression is always false because 
'else if' condition matches previous condition at line 922.
[staging/src/amf/amfd/sg.cc:394]: (style) Condition 'rc!=0' is always false
[staging/src/amf/amfd/sg.cc:42]: (style) The scope of the variable 'rc' can be 
reduced.
[staging/src/amf/amfd/sg.cc:1145]: (style) The scope of the variable 'su' can 
be reduced.
[staging/src/amf/amfd/sg.cc:2203]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/sg_2n_fsm.cc:3968] -> 
[staging/src/amf/amfd/sg_2n_fsm.cc:3969]: (style) Variable 'a_susi' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/sg_2n_fsm.cc:2789]: (style) The scope of the variable 
'a_susi' can be reduced.
[staging/src/amf/amfd/sg_2n_fsm.cc:2790]: (style) The scope of the variable 
'o_su' can be reduced.
[staging/src/amf/amfd/sg_nored_fsm.cc:111]: (style) The scope of the variable 
'flag' can be reduced.
[staging/src/amf/amfd/sg_npm_fsm.cc:2225] -> 
[staging/src/amf/amfd/sg_npm_fsm.cc:2233]: (style) Variable 'susi' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/sg_npm_fsm.cc:1071]: (style) The scope of the variable 
'l_flag' can be reduced.
[staging/src/amf/amfd/sg_npm_fsm.cc:1263]: (style) The scope of the variable 
'l_flag' can be reduced.
[staging/src/amf/amfd/sg_npm_fsm.cc:1391]: (style) The scope of the variable 
'a_susi' can be reduced.
[staging/src/amf/amfd/sg_npm_fsm.cc:1557]: (style) The scope of the variable 
'flag' can be reduced.
[staging/src/amf/amfd/sg_npm_fsm.cc:1557]: (style) The scope of the variable 
'fover_progress' can be reduced.
[staging/src/amf/amfd/sg_npm_fsm.cc:2460]: (style) The scope of the variable 
'susi_assgn_failed' can be reduced.
[staging/src/amf/amfd/sg_npm_fsm.cc:2831]: (style) The scope of the variable 
'o_susi' can be reduced.
[staging/src/amf/amfd/sg_npm_fsm.cc:3786]: (style) The scope of the variable 
'ot_susi' can be reduced.
[staging/src/amf/amfd/sg_npm_fsm.cc:4064]: (style) The scope of the variable 
'o_su' can be reduced.
[staging/src/amf/amfd/sg_npm_fsm.cc:4065]: (style) The scope of the variable 
'o_susi' can be reduced.
[staging/src/amf/amfd/sg_npm_fsm.cc:4189]: (style) The scope of the variable 
'rc' can be reduced.
[staging/src/amf/amfd/sg_nway_fsm.cc:1139]: (warning) Assignment of function 
parameter has no effect outside the function. Did you forget dereferencing it?
[staging/src/amf/amfd/sg_nway_fsm.cc:147] -> 
[staging/src/amf/amfd/sg_nway_fsm.cc:146]: (warning) Either the condition 
'!curr_susi' is redundant or there is possible null pointer dereference: 
curr_susi.
[staging/src/amf/amfd/sg_nway_fsm.cc:148] -> 
[staging/src/amf/amfd/sg_nway_fsm.cc:146]: (warning) Either the condition 
'!curr_susi' is redundant or there is possible null pointer dereference: 
curr_susi.
[staging/src/amf/amfd/sg_nway_fsm.cc:640] -> 
[staging/src/amf/amfd/sg_nway_fsm.cc:639]: (warning) Either the condition 
'!curr_susi' is redundant or there is possible null pointer dereference: 
curr_susi.
[staging/src/amf/amfd/sg_nway_fsm.cc:641] -> 
[staging/src/amf/amfd/sg_nway_fsm.cc:639]: (warning) Either the condition 
'!curr_susi' is redundant or there is possible null pointer dereference: 
curr_susi.
[staging/src/amf/amfd/sg_nway_fsm.cc:666] -> 
[staging/src/amf/amfd/sg_nway_fsm.cc:665]: (warning) Either the condition 
'!curr_susi' is redundant or there is possible null pointer dereference: 
curr_susi.
[staging/src/amf/amfd/sg_nway_fsm.cc:667] -> 
[staging/src/amf/amfd/sg_nway_fsm.cc:665]: (warning) Either the condition 
'!curr_susi' is redundant or there is possible null pointer dereference: 
curr_susi.
[staging/src/amf/amfd/sg_nway_fsm.cc:350] -> 
[staging/src/amf/amfd/sg_nway_fsm.cc:355]: (style) Variable 't_susi' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/sg_nway_fsm.cc:791] -> 
[staging/src/amf/amfd/sg_nway_fsm.cc:803]: (style) Variable 'susi' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/sg_nway_fsm.cc:1255] -> 
[staging/src/amf/amfd/sg_nway_fsm.cc:1257]: (style) Variable 'preferred_su' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/sg_nway_fsm.cc:2785] -> 
[staging/src/amf/amfd/sg_nway_fsm.cc:2786]: (style) Variable 't_susi' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/sg_nway_fsm.cc:2864] -> 
[staging/src/amf/amfd/sg_nway_fsm.cc:2872]: (style) Variable 't_susi' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/sg_nway_fsm.cc:3479]: (style) The scope of the variable 
'is_su_present' can be reduced.
[staging/src/amf/amfd/sg_nway_fsm.cc:1285]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/sg_nway_fsm.cc:1410]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/sg_nwayact_fsm.cc:92]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/sgproc.cc:663] -> [staging/src/amf/amfd/sgproc.cc:664]: 
(style) Variable 'node' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/sgproc.cc:672] -> [staging/src/amf/amfd/sgproc.cc:673]: 
(style) Variable 'node' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/sgproc.cc:1887]: (style) Variable 'num_su' is modified 
but its new value is never used.
[staging/src/amf/amfd/sgproc.cc:650]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/sgproc.cc:1501]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/sgtype.cc:86]: (style) The scope of the variable 'sut' 
can be reduced.
[staging/src/amf/amfd/si.cc:165] -> [staging/src/amf/amfd/si.cc:172]: (style) 
Variable 'i_csi' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/si.cc:250] -> [staging/src/amf/amfd/si.cc:255]: (style) 
Variable 'prev_csi' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/si.cc:249] -> [staging/src/amf/amfd/si.cc:256]: (style) 
Variable 'i_csi' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/si.cc:1110] -> [staging/src/amf/amfd/si.cc:1111]: (style) 
Variable 'no_of_sisus_to_delete' is reassigned a value before the old one has 
been used.
[staging/src/amf/amfd/si.cc:325]: (style) The scope of the variable 'temp' can 
be reduced.
[staging/src/amf/amfd/si.cc:385]: (style) The scope of the variable 'rc' can be 
reduced.
[staging/src/amf/amfd/si.cc:1490]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/si_dep.cc:301] -> [staging/src/amf/amfd/si_dep.cc:308]: 
(style) Variable 'dep_si' is reassigned a value before the old one has been 
used.
[staging/src/amf/amfd/si_dep.cc:302] -> [staging/src/amf/amfd/si_dep.cc:314]: 
(style) Variable 'spons_si_node' is reassigned a value before the old one has 
been used.
[staging/src/amf/amfd/si_dep.cc:442] -> [staging/src/amf/amfd/si_dep.cc:447]: 
(style) Variable 'susi' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/si_dep.cc:532] -> [staging/src/amf/amfd/si_dep.cc:537]: 
(style) Variable 'evt' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/si_dep.cc:598] -> [staging/src/amf/amfd/si_dep.cc:605]: 
(style) Variable 'si' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/si_dep.cc:599] -> [staging/src/amf/amfd/si_dep.cc:606]: 
(style) Variable 'spons_si' is reassigned a value before the old one has been 
used.
[staging/src/amf/amfd/si_dep.cc:856] -> [staging/src/amf/amfd/si_dep.cc:860]: 
(style) Variable 'si' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/si_dep.cc:915] -> [staging/src/amf/amfd/si_dep.cc:919]: 
(style) Variable 'spons_si' is reassigned a value before the old one has been 
used.
[staging/src/amf/amfd/si_dep.cc:1617] -> [staging/src/amf/amfd/si_dep.cc:1621]: 
(style) Variable 'assignmemt_status' is reassigned a value before the old one 
has been used.
[staging/src/amf/amfd/si_dep.cc:978]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/si_dep.cc:1023]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/si_dep.cc:1075]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/si_dep.cc:1470]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/si_dep.cc:1799]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/si_dep.cc:2058]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/si_dep.cc:2130]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/si_dep.cc:2194]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/si_dep.cc:2270]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/si_dep.cc:2524]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/siass.cc:1077] -> [staging/src/amf/amfd/siass.cc:1082]: 
(style) Variable 'node' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/siass.cc:452]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/siass.cc:473]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/siass.cc:1042]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/sirankedsu.cc:45] -> 
[staging/src/amf/amfd/sirankedsu.cc:51]: (style) Variable 'avd_si' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/sirankedsu.cc:107] -> 
[staging/src/amf/amfd/sirankedsu.cc:113]: (style) Variable 'ranked_su_per_si' 
is reassigned a value before the old one has been used.
[staging/src/amf/amfd/sirankedsu.cc:163] -> 
[staging/src/amf/amfd/sirankedsu.cc:176]: (style) Variable 
'avd_sus_per_si_rank' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/sirankedsu.cc:235] -> 
[staging/src/amf/amfd/sirankedsu.cc:245]: (style) Variable 'avd_si' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/sirankedsu.cc:354]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/su.cc:518]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/su.cc:1948]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/sutype.cc:103]: (style) Condition 'rc!=0' is always false
[staging/src/amf/amfd/util.cc:2022]: (warning) Possible null pointer 
dereference: avnd
[staging/src/amf/amfd/util.cc:1272] -> [staging/src/amf/amfd/util.cc:1278]: 
(style) Variable 'd2n_msg' is reassigned a value before the old one has been 
used.
[staging/src/amf/amfd/util.cc:1566] -> [staging/src/amf/amfd/util.cc:1581]: 
(style) Variable 'rc' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/util.cc:2078]: (style) Consecutive return, break, 
continue, goto or throw statements are unnecessary.
[staging/src/amf/amfd/util.cc:1032]: (style) The scope of the variable 'i' can 
be reduced.
[staging/src/amf/amfd/util.cc:533]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/util.cc:541]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/util.cc:1392]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/util.cc:1408]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/util.cc:1419]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/util.cc:1446]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/util.cc:1465]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/util.cc:1482]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/util.cc:1510]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/util.cc:1526]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/util.cc:1542]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/tests/test_amfdb.cc:29]: (style) The function 'SetUp' is 
never used.
[staging/src/amf/amfd/tests/test_amfdb.cc:33]: (style) The function 'TearDown' 
is never used.
[staging/src/amf/amfd/mds.cc:534]: (style) The function 'avd_avnd_mds_send' is 
never used.
[staging/src/amf/amfd/ndmsg.cc:177]: (style) The function 'avd_mds_dec_flat' is 
never used.
[staging/src/amf/amfd/ndmsg.cc:90]: (style) The function 'avd_mds_enc_flat' is 
never used.
[staging/src/amf/amfd/ndfsm.cc:1000]: (style) The function 'avd_node_down' is 
never used.
[staging/src/amf/amfd/ntf.cc:130]: (style) The function 
'avd_send_cluster_reset_alarm' is never used.
[staging/src/amf/amfd/ntf.cc:367]: (style) The function 
'avd_send_su_ha_readiness_state_chg_ntf' is never used.
[staging/src/amf/amfd/util.cc:296]: (style) The function 
'avd_snd_oper_state_msg' is never used.
[staging/src/amf/amfd/chkop.cc:132]: (style) The function 
'avsv_mbcsv_deregister' is never used.
[staging/src/amf/amfd/chkop.cc:1147]: (style) The function 'avsv_mbcsv_obj_set' 
is never used.
[staging/src/amf/amfd/chkop.cc:865]: (style) The function 'avsv_send_ckpt_data' 
is never used.
[staging/src/amf/amfd/node.cc:35]: (style) The function 'operator<' is never 
used.

diff --git a/src/amf/amfd/app.cc b/src/amf/amfd/app.cc
--- a/src/amf/amfd/app.cc
+++ b/src/amf/amfd/app.cc
@@ -282,7 +282,6 @@ done:
 static void app_ccb_apply_cb(CcbUtilOperationData_t *opdata)
 {
        AVD_APP *app;
-       int i = 0;
 
        TRACE_ENTER2("CCB ID %llu, '%s'", opdata->ccbId, 
osaf_extended_name_borrow(&opdata->objectName));
 
@@ -295,7 +294,7 @@ static void app_ccb_apply_cb(CcbUtilOper
        case CCBUTIL_MODIFY: {
                const SaImmAttrModificationT_2 *attr_mod;
                app = app_db->find(Amf::to_string(&opdata->objectName));
-
+               int i = 0;
                while ((attr_mod = opdata->param.modify.attrMods[i++]) != 
nullptr) {
                        const SaImmAttrValuesT_2 *attribute = 
&attr_mod->modAttr;
 
diff --git a/src/amf/amfd/apptype.cc b/src/amf/amfd/apptype.cc
--- a/src/amf/amfd/apptype.cc
+++ b/src/amf/amfd/apptype.cc
@@ -66,7 +66,6 @@ static int is_config_valid(const std::st
        int i = 0;
        unsigned j;
        std::string::size_type parent;
-       AVD_AMF_SG_TYPE *sg_type;
        const SaImmAttrValuesT_2 *attr;
 
        parent = dn.find(',');
@@ -90,7 +89,7 @@ static int is_config_valid(const std::st
 
        for (j = 0; j < attr->attrValuesNumber; j++) {
                SaNameT *name = (SaNameT *)attr->attrValues[j];
-               sg_type = sgtype_db->find(Amf::to_string(name));
+               AVD_AMF_SG_TYPE *sg_type = 
sgtype_db->find(Amf::to_string(name));
                if (sg_type == nullptr) {
                        if (opdata == nullptr) {
                                report_ccb_validation_error(opdata, "'%s' does 
not exist in model", osaf_extended_name_borrow(name));
@@ -113,7 +112,6 @@ static AVD_APP_TYPE *apptype_create(cons
 {
        int i = 0;
        unsigned int j;
-       int rc = -1;
        AVD_APP_TYPE *app_type;
        const SaImmAttrValuesT_2 *attr;
 
@@ -132,11 +130,6 @@ static AVD_APP_TYPE *apptype_create(cons
                
app_type->sgAmfApptSGTypes.push_back(Amf::to_string(static_cast<SaNameT*>(attr->attrValues[j])));
        }
 
-       rc = 0;
-
-       if (rc != 0)
-               apptype_delete(&app_type);
-
        TRACE_LEAVE();
 
        return app_type;
diff --git a/src/amf/amfd/chkop.cc b/src/amf/amfd/chkop.cc
--- a/src/amf/amfd/chkop.cc
+++ b/src/amf/amfd/chkop.cc
@@ -1294,12 +1294,11 @@ free_msg:
 uint32_t avsv_send_data_req(AVD_CL_CB *cb)
 {
        NCS_MBCSV_ARG mbcsv_arg = {};
-       NCS_UBAID *uba = nullptr;
 
        mbcsv_arg.i_op = NCS_MBCSV_OP_SEND_DATA_REQ;
        mbcsv_arg.i_mbcsv_hdl = cb->mbcsv_hdl;
 
-       uba = &mbcsv_arg.info.send_data_req.i_uba;
+       NCS_UBAID *uba = &mbcsv_arg.info.send_data_req.i_uba;
 
        memset(uba, '\0', sizeof(NCS_UBAID));
 
diff --git a/src/amf/amfd/ckpt_dec.cc b/src/amf/amfd/ckpt_dec.cc
--- a/src/amf/amfd/ckpt_dec.cc
+++ b/src/amf/amfd/ckpt_dec.cc
@@ -371,7 +371,6 @@ void decode_app(NCS_UBAID *ub, AVD_APP *
 \**************************************************************************/
 static uint32_t dec_app_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec)
 {
-       uint32_t status = NCSCC_RC_SUCCESS;
        AVD_APP app;
        
        TRACE_ENTER();
@@ -379,7 +378,7 @@ static uint32_t dec_app_config(AVD_CL_CB
        osafassert(dec->i_action == NCS_MBCSV_ACT_UPDATE);
        decode_app(&dec->i_uba, &app);
        
-       status = avd_ckpt_app(cb, &app, dec->i_action);
+       uint32_t status = avd_ckpt_app(cb, &app, dec->i_action);
 
        if (NCSCC_RC_SUCCESS == status)
                cb->async_updt_cnt.app_updt++;
@@ -570,11 +569,9 @@ static uint32_t dec_si_config(AVD_CL_CB 
 \**************************************************************************/
 static uint32_t dec_sg_admin_si(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec)
 {
-       uint32_t status = NCSCC_RC_SUCCESS;
-
        TRACE_ENTER2("i_action '%u'", dec->i_action);
 
-       status = avd_ckpt_sg_admin_si(cb, &dec->i_uba, dec->i_action);
+       uint32_t status = avd_ckpt_sg_admin_si(cb, &dec->i_uba, dec->i_action);
 
        /* If update is successful, update async update count */
        if (NCSCC_RC_SUCCESS == status)
@@ -1104,10 +1101,10 @@ static uint32_t dec_sg_admin_state(AVD_C
        if ((sg->sg_ncs_spec == false) && (sg->sg_redundancy_model == 
SA_AMF_2N_REDUNDANCY_MODEL)) {
                if (((sg->saAmfSGAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) ||
                         (sg->saAmfSGAdminState == SA_AMF_ADMIN_LOCKED)) &&
-                        (sg->ng_using_saAmfSGAdminState == false)) { 
-                       for (std::map<std::string, AVD_AMF_NG*>::const_iterator 
it = nodegroup_db->begin();
-                                       it != nodegroup_db->end(); it++) {
-                               AVD_AMF_NG *ng = it->second;
+                        (sg->ng_using_saAmfSGAdminState == false)) {
+
+                       for (const auto& value : *nodegroup_db) {
+                               AVD_AMF_NG *ng = value.second;
                                if ((sg->is_sg_assigned_only_in_ng(ng) == true) 
&&
                                                ((ng->saAmfNGAdminState == 
SA_AMF_ADMIN_SHUTTING_DOWN) ||
                                                 (ng->saAmfNGAdminState == 
SA_AMF_ADMIN_LOCKED)) &&
diff --git a/src/amf/amfd/ckpt_edu.cc b/src/amf/amfd/ckpt_edu.cc
--- a/src/amf/amfd/ckpt_edu.cc
+++ b/src/amf/amfd/ckpt_edu.cc
@@ -48,12 +48,11 @@
 *****************************************************************************/
 uint32_t avd_compile_ckpt_edp(AVD_CL_CB *cb)
 {
-       uint32_t rc = NCSCC_RC_SUCCESS;
        EDU_ERR err = EDU_NORMAL;
 
        m_NCS_EDU_HDL_INIT(&cb->edu_hdl);
 
-       rc = m_NCS_EDU_COMPILE_EDP(&cb->edu_hdl, 
avsv_edp_ckpt_msg_async_updt_cnt, &err);
+       uint32_t rc = m_NCS_EDU_COMPILE_EDP(&cb->edu_hdl, 
avsv_edp_ckpt_msg_async_updt_cnt, &err);
        if (rc != NCSCC_RC_SUCCESS)
                goto error;
 
diff --git a/src/amf/amfd/ckpt_enc.cc b/src/amf/amfd/ckpt_enc.cc
--- a/src/amf/amfd/ckpt_enc.cc
+++ b/src/amf/amfd/ckpt_enc.cc
@@ -1947,9 +1947,8 @@ static uint32_t enc_cs_node_config(AVD_C
        /* 
         * Walk through the entire list and send the entire list data.
         */
-       for (std::map<std::string, AVD_AVND *>::const_iterator it = 
node_name_db->begin();
-                       it != node_name_db->end(); it++) {
-               AVD_AVND *avnd_node = it->second;
+       for (const auto& value : *node_name_db) {
+               AVD_AVND *avnd_node = value.second;
                encode_node_config(&enc->io_uba, avnd_node, 
enc->i_peer_version);
                (*num_of_obj)++;
        }
@@ -1979,8 +1978,8 @@ static uint32_t enc_cs_app_config(AVD_CL
        /* Walk through all application instances and encode. */
        // If use std=c++11 in Makefile.common the following syntax can be used 
instead:
        // for (auto it = app_db->begin()
-       for (std::map<std::string, AVD_APP*>::const_iterator it = 
app_db->begin(); it != app_db->end(); it++) {
-               AVD_APP *app = it->second;
+       for (const auto& value : *app_db) {
+               AVD_APP *app = value.second;
                encode_app(&enc->io_uba, app);
                (*num_of_obj)++;
        }
@@ -2011,9 +2010,8 @@ static uint32_t enc_cs_sg_config(AVD_CL_
        /* 
         * Walk through the entire list and send the entire list data.
         */
-       for (std::map<std::string, AVD_SG*>::const_iterator it = sg_db->begin();
-                       it != sg_db->end(); it++) {
-               AVD_SG *sg = it->second;
+       for (const auto& value : *sg_db) {
+               AVD_SG *sg = value.second;
                encode_sg(&enc->io_uba, sg);
                (*num_of_obj)++;
        }
@@ -2040,9 +2038,8 @@ static uint32_t enc_cs_su_config(AVD_CL_
 {
        TRACE_ENTER();
 
-       for (std::map<std::string, AVD_SU*>::const_iterator it = su_db->begin();
-                       it != su_db->end(); it++) {
-               encode_su(&enc->io_uba, it->second, enc->i_peer_version);
+       for (const auto& value : *su_db) {
+               encode_su(&enc->io_uba, value.second, enc->i_peer_version);
                (*num_of_obj)++;
        }
 
@@ -2072,9 +2069,8 @@ static uint32_t enc_cs_si_config(AVD_CL_
        /* 
         * Walk through the entire list and send the entire list data.
         */
-       for (std::map<std::string, AVD_SI*>::const_iterator it = si_db->begin();
-                       it != si_db->end(); it++) {
-               const AVD_SI *si = it->second;
+       for (const auto& value : *si_db) {
+               const AVD_SI *si = value.second;
                encode_si(cb, &enc->io_uba, si, enc->i_peer_version);
 
                (*num_of_obj)++;
@@ -2107,9 +2103,8 @@ static uint32_t enc_cs_sg_su_oper_list(A
         * Walk through the entire SG list and send the SU operation list
         * for that SG and then move to next SG.
         */
-       for (std::map<std::string, AVD_SG*>::const_iterator it = sg_db->begin();
-                       it != sg_db->end(); it++) {
-               AVD_SG *sg = it->second;
+       for (const auto& value : *sg_db) {
+               AVD_SG *sg = value.second;
                status = enc_su_oper_list(cb, sg, enc);
 
                if (status != NCSCC_RC_SUCCESS) {
@@ -2147,9 +2142,8 @@ static uint32_t enc_cs_sg_admin_si(AVD_C
        /* 
         * Walk through the entire list and send the entire list data.
         */
-       for (std::map<std::string, AVD_SG*>::const_iterator it = sg_db->begin();
-                       it != sg_db->end(); it++) {
-               AVD_SG *sg = it->second;
+       for (const auto& value : *sg_db) {
+               AVD_SG *sg = value.second;
                if (nullptr == sg->admin_si) 
                        continue;
 
@@ -2172,9 +2166,8 @@ static uint32_t enc_cs_si_trans(AVD_CL_C
 {
        TRACE_ENTER();
 
-       for (std::map<std::string, AVD_SG*>::const_iterator it = sg_db->begin();
-                       it != sg_db->end(); it++) {
-               AVD_SG *sg = it->second;
+       for (const auto& value : *sg_db) {
+               AVD_SG *sg = value.second;
                if (sg->si_tobe_redistributed != nullptr) {
                        encode_si_trans(&enc->io_uba, sg, enc->i_peer_version);
                        (*num_of_obj)++;
@@ -2212,9 +2205,8 @@ static uint32_t enc_cs_siass(AVD_CL_CB *
         * are sent.We will send the corresponding COMP_CSI relationship for 
that SU_SI
         * in the same update.
         */
-       for (std::map<std::string, AVD_SU*>::const_iterator it = su_db->begin();
-                       it != su_db->end(); it++) {
-               su = it->second;
+       for (const auto& value : *su_db) {
+               su = value.second;
 
                for (rel = su->list_of_susi; rel != nullptr; rel = 
rel->su_next) {
                        copy = *rel;
@@ -2248,9 +2240,8 @@ static uint32_t enc_cs_comp_config(AVD_C
        /* 
         * Walk through the entire list and send the entire list data.
         */
-       for (std::map<std::string, AVD_COMP*>::const_iterator it = 
comp_db->begin();
-                       it != comp_db->end(); it++) {
-               AVD_COMP *comp  = it->second;
+       for (const auto& value : *comp_db) {
+               AVD_COMP *comp  = value.second;
 
                 encode_comp(&enc->io_uba, comp);
 
@@ -2278,14 +2269,13 @@ static uint32_t enc_cs_comp_config(AVD_C
 \**************************************************************************/
 static uint32_t enc_cs_async_updt_cnt(AVD_CL_CB *cb, NCS_MBCSV_CB_ENC *enc, 
uint32_t *num_of_obj)
 {
-       uint32_t status = NCSCC_RC_SUCCESS;
        EDU_ERR ederror = static_cast<EDU_ERR>(0);
        TRACE_ENTER();
 
        /* 
         * Encode and send async update counts for all the data structures.
         */
-       status = m_NCS_EDU_VER_EXEC(&cb->edu_hdl, 
avsv_edp_ckpt_msg_async_updt_cnt,
+       uint32_t status = m_NCS_EDU_VER_EXEC(&cb->edu_hdl, 
avsv_edp_ckpt_msg_async_updt_cnt,
                                    &enc->io_uba, EDP_OP_TYPE_ENC, 
&cb->async_updt_cnt, &ederror, enc->i_peer_version);
 
        if (status != NCSCC_RC_SUCCESS)
@@ -2311,7 +2301,6 @@ static uint32_t enc_cs_async_updt_cnt(AV
 \**************************************************************************/
 uint32_t avd_enc_warm_sync_rsp(AVD_CL_CB *cb, NCS_MBCSV_CB_ENC *enc)
 {
-       uint32_t status = NCSCC_RC_SUCCESS;
        EDU_ERR ederror = static_cast<EDU_ERR>(0);
        TRACE_ENTER();
 
@@ -2319,7 +2308,7 @@ uint32_t avd_enc_warm_sync_rsp(AVD_CL_CB
         * Encode and send latest async update counts. (In the same manner we 
sent
         * in the last message of the cold sync response.
         */
-       status = m_NCS_EDU_VER_EXEC(&cb->edu_hdl, 
avsv_edp_ckpt_msg_async_updt_cnt,
+       uint32_t status = m_NCS_EDU_VER_EXEC(&cb->edu_hdl, 
avsv_edp_ckpt_msg_async_updt_cnt,
                                    &enc->io_uba, EDP_OP_TYPE_ENC, 
&cb->async_updt_cnt, &ederror, enc->i_peer_version);
 
        if (status != NCSCC_RC_SUCCESS)
@@ -2466,9 +2455,8 @@ static uint32_t enc_cs_comp_cs_type_conf
        /*
         * Walk through the entire list and send the entire list data.
         */
-       for (std::map<std::string, AVD_COMPCS_TYPE*>::const_iterator it = 
compcstype_db->begin();
-                       it != compcstype_db->end(); it++) {
-               AVD_COMPCS_TYPE *compcstype = it->second;
+       for (const auto& value : *compcstype_db) {
+               AVD_COMPCS_TYPE *compcstype = value.second;
                encode_comp_cs_type_config(&enc->io_uba, compcstype, 
enc->i_peer_version);
 
                (*num_of_obj)++;
diff --git a/src/amf/amfd/clm.cc b/src/amf/amfd/clm.cc
--- a/src/amf/amfd/clm.cc
+++ b/src/amf/amfd/clm.cc
@@ -340,9 +340,8 @@ static void clm_track_cb(const SaClmClus
                                   in saClmClusterTrack call so update the 
local database */
                                /* get the first node */
                                node = nullptr;
-                               for (std::map<std::string, AVD_AVND 
*>::const_iterator it = node_name_db->begin();
-                                               it != node_name_db->end(); 
it++) {
-                                       node = it->second;
+                               for (const auto& value : *node_name_db) {
+                                       node = value.second;
                                        if 
(node->saAmfNodeClmNode.compare(node_name) == 0) {
                                                break;
                                        }
diff --git a/src/amf/amfd/cluster.cc b/src/amf/amfd/cluster.cc
--- a/src/amf/amfd/cluster.cc
+++ b/src/amf/amfd/cluster.cc
@@ -78,9 +78,8 @@ void avd_cluster_tmr_init_evh(AVD_CL_CB 
        // to waits for all veteran nodes becoming ENABLED
        // This set_leds message will enables AMFND starting sending susi 
assignment
        // message to AMFD
-       for (std::map<std::string, AVD_AVND *>::const_iterator it = 
node_name_db->begin();
-                       it != node_name_db->end(); it++) {
-               node = it->second;
+       for (const auto& value : *node_name_db) {
+               node = value.second;
                if (node->node_state == AVD_AVND_STATE_PRESENT &&
                        node->node_info.nodeId != cb->node_id_avd &&
                        node->node_info.nodeId != cb->node_id_avd_other)
@@ -91,9 +90,8 @@ void avd_cluster_tmr_init_evh(AVD_CL_CB 
         * system that are not NCS specific.
         */
 
-       for (std::map<std::string, AVD_SG*>::const_iterator it = sg_db->begin();
-                       it != sg_db->end(); it++) {
-               AVD_SG *i_sg = it->second;
+       for (const auto& value : *sg_db) {
+               AVD_SG *i_sg = value.second;
                if ((i_sg->list_of_su.empty() == true) || (i_sg->sg_ncs_spec == 
true)) {
                        continue;
                }
@@ -112,10 +110,8 @@ void avd_cluster_tmr_init_evh(AVD_CL_CB 
        if (cb->scs_absence_max_duration > 0) {
                TRACE("check if any SU is auto repair enabled");
 
-               for (std::map<std::string, AVD_SU*>::const_iterator it = 
su_db->begin();
-                       it != su_db->end(); it++) {
-
-                       su = it->second;
+               for (const auto& value : *su_db) {
+                       su = value.second;
 
                        if (su->list_of_susi == nullptr &&
                                su->su_on_node != nullptr &&
diff --git a/src/amf/amfd/comp.cc b/src/amf/amfd/comp.cc
--- a/src/amf/amfd/comp.cc
+++ b/src/amf/amfd/comp.cc
@@ -46,11 +46,10 @@ AmfDb<std::string, AVD_COMP> *comp_db = 
 
 void avd_comp_db_add(AVD_COMP *comp)
 {
-       unsigned int rc;
        const std::string comp_name(Amf::to_string(&comp->comp_info.name));
 
        if (comp_db->find(comp_name) == nullptr) {
-               rc = comp_db->insert(comp_name, comp);
+               unsigned int rc = comp_db->insert(comp_name, comp);
                osafassert(rc == NCSCC_RC_SUCCESS);
        }
 }
@@ -943,9 +942,8 @@ static SaAisErrorT ccb_completed_modify_
                           ctcstype does not exist with any cstypes supported 
by this component via compcstype.
                         */ 
 
-                       for (std::map<std::string, 
AVD_COMPCS_TYPE*>::const_iterator it = compcstype_db->begin();
-                                       it != compcstype_db->end(); it++) {
-                               AVD_COMPCS_TYPE *compcstype = it->second;
+                       for (const auto& value : *compcstype_db) {
+                               AVD_COMPCS_TYPE *compcstype = value.second;
                                if (compcstype->comp == comp) {
                                        std::string cstype_name;
                                        AVD_CTCS_TYPE *ctcstype = nullptr;
@@ -1267,7 +1265,6 @@ static void comp_ccb_apply_modify_hdlr(s
        int i = 0;
        AVD_COMP *comp;
        bool node_present = false;
-       AVD_AVND *su_node_ptr = nullptr;
        AVD_COMP_TYPE *comp_type;
        AVSV_PARAM_INFO param;
        bool value_is_deleted;
@@ -1282,7 +1279,7 @@ static void comp_ccb_apply_modify_hdlr(s
        param.name = comp->comp_info.name;
        comp_type = comptype_db->find(comp->saAmfCompType);
 
-       su_node_ptr = comp->su->get_node_ptr();
+       AVD_AVND *su_node_ptr = comp->su->get_node_ptr();
 
        if ((su_node_ptr->node_state == AVD_AVND_STATE_PRESENT) ||
            (su_node_ptr->node_state == AVD_AVND_STATE_NO_CONFIG) ||
diff --git a/src/amf/amfd/compcstype.cc b/src/amf/amfd/compcstype.cc
--- a/src/amf/amfd/compcstype.cc
+++ b/src/amf/amfd/compcstype.cc
@@ -43,10 +43,8 @@ AVD_COMPCS_TYPE::AVD_COMPCS_TYPE(const s
 
 void avd_compcstype_db_add(AVD_COMPCS_TYPE *cst)
 {
-       unsigned int rc;
-
        if (compcstype_db->find(cst->name) == nullptr) {
-               rc = compcstype_db->insert(cst->name, cst); 
+               unsigned int rc = compcstype_db->insert(cst->name, cst); 
                osafassert(rc == NCSCC_RC_SUCCESS);
        }
 }
@@ -89,14 +87,13 @@ static void compcstype_add_to_model(AVD_
 
 AVD_COMPCS_TYPE * avd_compcstype_find_match(const std::string& cstype_name, 
const AVD_COMP *comp)
 {
-       AVD_COMPCS_TYPE *cst = nullptr;
        SaNameT dn;
        const SaNameTWrapper cstype(cstype_name);
 
        TRACE_ENTER();
        avsv_create_association_class_dn(cstype, &comp->comp_info.name, 
"safSupportedCsType", &dn);
        TRACE("'%s'", osaf_extended_name_borrow(&dn));
-       cst = compcstype_db->find(Amf::to_string(&dn));
+       AVD_COMPCS_TYPE *cst = compcstype_db->find(Amf::to_string(&dn));
        osaf_extended_name_free(&dn);
        TRACE_LEAVE();
        return cst;
diff --git a/src/amf/amfd/comptype.cc b/src/amf/amfd/comptype.cc
--- a/src/amf/amfd/comptype.cc
+++ b/src/amf/amfd/comptype.cc
@@ -414,7 +414,6 @@ done1:
 static void ccb_apply_modify_hdlr(const CcbUtilOperationData_t *opdata)
 {
        const SaImmAttrModificationT_2 *attr_mod;
-       int i;
        AVD_COMP_TYPE *comp_type;
        SaNameT comp_type_name;
 
@@ -442,7 +441,7 @@ static void ccb_apply_modify_hdlr(const 
                
        std::set<AVD_AVND*>::iterator it;
        for (it = node_set.begin(); it != node_set.end(); ++it) {
-               i = 0;
+               int i = 0;
                while ((attr_mod = opdata->param.modify.attrMods[i++]) != 
nullptr) {
                        AVSV_PARAM_INFO param;
                        memset(&param, 0, sizeof(param));
diff --git a/src/amf/amfd/csi.cc b/src/amf/amfd/csi.cc
--- a/src/amf/amfd/csi.cc
+++ b/src/amf/amfd/csi.cc
@@ -623,7 +623,7 @@ static SaAisErrorT csi_ccb_completed_mod
                                 goto done;
                        }
                         uint32_t val = 
static_cast<uint32_t>(*(uint32_t*)attr_mod->modAttr.attrValues[0]);
-                        if ((val != true) && (val != false)) {
+                        if (val > 1) {
                                 report_ccb_validation_error(opdata,
                                       "Modification of 
osafAmfCSICommunicateCsiAttributeChange fails," 
                                      " Invalid Input %d",val);
@@ -918,11 +918,10 @@ static void csi_ccb_apply_modify_hdlr(st
 {               
        const SaImmAttrModificationT_2 *attr_mod;
        int i = 0;
-       AVD_CSI *csi = nullptr;
 
        TRACE_ENTER2("CCB ID %llu, '%s'", opdata->ccbId, 
osaf_extended_name_borrow(&opdata->objectName));
  
-       csi = csi_db->find(Amf::to_string(&opdata->objectName));
+       AVD_CSI *csi = csi_db->find(Amf::to_string(&opdata->objectName));
        assert(csi != nullptr);
        AVD_SI *si = csi->si;
        assert(si != nullptr);
@@ -1367,12 +1366,11 @@ void avd_compcsi_from_csi_and_susi_delet
 
 void avd_csi_remove_csiattr(AVD_CSI *csi, AVD_CSI_ATTR *attr)
 {
-       AVD_CSI_ATTR *i_attr = nullptr;
        AVD_CSI_ATTR *p_attr = nullptr;
 
        TRACE_ENTER();
        /* remove ATTR from CSI list */
-       i_attr = csi->list_attributes;
+       AVD_CSI_ATTR *i_attr = csi->list_attributes;
 
        while ((i_attr != nullptr) && (i_attr != attr)) {
                p_attr = i_attr;
@@ -1407,12 +1405,9 @@ void avd_csi_add_csiattr(AVD_CSI *csi, A
        TRACE_ENTER();
        /* Count number of attributes (multivalue) */
        ptr = csiattr;
-       while (ptr != nullptr) {
+       while (ptr->attr_next != nullptr) {
                cnt++;
-               if (ptr->attr_next != nullptr)
-                       ptr = ptr->attr_next;
-               else
-                       break;
+               ptr = ptr->attr_next;
        }
 
        ptr->attr_next = csi->list_attributes;
@@ -1488,10 +1483,8 @@ bool are_sponsor_csis_assigned_in_su(AVD
  */
 SaAisErrorT avd_compcsi_recreate(AVSV_N2D_ND_CSICOMP_STATE_MSG_INFO *info)
 {
-       AVD_SU_SI_REL *susi;
-       const AVD_SI *si;
+       AVD_COMP *comp;
        AVD_CSI *csi;
-       AVD_COMP *comp;
        const AVSV_CSICOMP_STATE_MSG *csicomp;
        const AVSV_COMP_STATE_MSG *comp_state;
 
@@ -1507,10 +1500,10 @@ SaAisErrorT avd_compcsi_recreate(AVSV_N2
                TRACE("Received CSICOMP state msg: csi %s, comp %s",
                        osaf_extended_name_borrow(&csicomp->safCSI), 
osaf_extended_name_borrow(&csicomp->safComp));
 
-               si = csi->si;
+               const AVD_SI *si = csi->si;
                osafassert(si);
 
-               susi = avd_susi_find(avd_cb, comp->su->name, si->name);
+               AVD_SU_SI_REL *susi = avd_susi_find(avd_cb, comp->su->name, 
si->name);
                if (susi == 0) {
                        LOG_ER("SU_SI_REL record for SU '%s' and SI '%s' was 
not found",
                          comp->su->name.c_str(), si->name.c_str());
diff --git a/src/amf/amfd/csiattr.cc b/src/amf/amfd/csiattr.cc
--- a/src/amf/amfd/csiattr.cc
+++ b/src/amf/amfd/csiattr.cc
@@ -538,25 +538,22 @@ static void csiattr_change_send_msg(AVD_
 static void csiattr_modify_apply(CcbUtilOperationData_t *opdata)
 {
        const SaImmAttrModificationT_2 *attr_mod;
-       const SaImmAttrValuesT_2 *attribute;
        AVD_CSI_ATTR *csiattr = nullptr, *i_attr, *tmp_csi_attr = nullptr;
        std::string csi_attr_name;
-       std::string csi_dn;
        int counter = 0;
        unsigned int i = 0;
-       AVD_CSI *csi;
 
        const std::string object_name(Amf::to_string(&opdata->objectName));
 
         /* extract the parent csi dn */
-       csi_dn = object_name.substr(object_name.find("safCsi="));
+       std::string csi_dn = object_name.substr(object_name.find("safCsi="));
 
-       csi = csi_db->find(csi_dn);
+       AVD_CSI *csi = csi_db->find(csi_dn);
 
        csiattr_dn_to_csiattr_name(object_name, csi_attr_name);
        /* create new name-value pairs for the modified csi attribute */
        while ((attr_mod = opdata->param.modify.attrMods[counter++]) != 
nullptr) {
-               attribute = &attr_mod->modAttr;
+               const SaImmAttrValuesT_2 *attribute = &attr_mod->modAttr;
                if (SA_IMM_ATTR_VALUES_ADD == attr_mod->modType) {
                        tmp_csi_attr = csi_name_value_pair_find_last_entry(csi, 
csi_attr_name);
                        if((nullptr != tmp_csi_attr)&&  
(osaf_extended_name_length(&tmp_csi_attr->name_value.value) == 0)) {
diff --git a/src/amf/amfd/ctcstype.cc b/src/amf/amfd/ctcstype.cc
--- a/src/amf/amfd/ctcstype.cc
+++ b/src/amf/amfd/ctcstype.cc
@@ -97,7 +97,6 @@ AVD_CTCS_TYPE::AVD_CTCS_TYPE(const std::
 static AVD_CTCS_TYPE *ctcstype_create(const std::string& dn, const 
SaImmAttrValuesT_2 **attributes)
 {
        AVD_CTCS_TYPE *ctcstype;
-       int rc = -1;
        SaAisErrorT error;
 
        TRACE_ENTER2("'%s'", dn.c_str());
@@ -115,12 +114,6 @@ static AVD_CTCS_TYPE *ctcstype_create(co
            SA_AIS_OK)
                ctcstype->saAmfCtDefNumMaxStandbyCSIs = -1;     /* no limit */
 
-       rc = 0;
-
-       if (rc != 0) {
-               delete ctcstype;
-               ctcstype = nullptr;
-       }
        TRACE_LEAVE();
        return ctcstype;
 }
@@ -228,10 +221,9 @@ AVD_CTCS_TYPE *get_ctcstype(const std::s
        SaNameT dn;
        const SaNameTWrapper comptype(comptype_name);
        const SaNameTWrapper cstype(cstype_name);
-       AVD_CTCS_TYPE *ctcs_type = nullptr;
        avsv_create_association_class_dn(cstype, comptype,
                        "safSupportedCsType", &dn);
-       ctcs_type = ctcstype_db->find(Amf::to_string(&dn));
+       AVD_CTCS_TYPE *ctcs_type = ctcstype_db->find(Amf::to_string(&dn));
        osaf_extended_name_free(&dn);
        return ctcs_type;
 }
diff --git a/src/amf/amfd/dmsg.cc b/src/amf/amfd/dmsg.cc
--- a/src/amf/amfd/dmsg.cc
+++ b/src/amf/amfd/dmsg.cc
@@ -58,12 +58,11 @@
 
 void avd_mds_d_enc(MDS_CALLBACK_ENC_INFO *enc_info)
 {
-       NCS_UBAID *uba = nullptr;
        uint8_t *data;
        AVD_D2D_MSG *msg = 0;
 
        msg = (AVD_D2D_MSG *)enc_info->i_msg;
-       uba = enc_info->io_uba;
+       NCS_UBAID *uba = enc_info->io_uba;
 
        data = ncs_enc_reserve_space(uba, 3 * sizeof(uint32_t));
        ncs_encode_32bit(&data, msg->msg_type);
@@ -233,5 +232,4 @@ uint32_t avd_d2d_msg_rcv(AVD_D2D_MSG *rc
 void avsv_d2d_msg_free(AVD_D2D_MSG *d2d_msg)
 {
        delete d2d_msg;
-       d2d_msg = nullptr;
 }
diff --git a/src/amf/amfd/hlttype.cc b/src/amf/amfd/hlttype.cc
--- a/src/amf/amfd/hlttype.cc
+++ b/src/amf/amfd/hlttype.cc
@@ -61,7 +61,6 @@ done:
 static void ccb_apply_modify_hdlr(const CcbUtilOperationData_t *opdata)
 {
        const SaImmAttrModificationT_2 *attr_mod;
-       int i;
        const AVD_COMP_TYPE *comp_type;
        std::string comp_type_name;
        const std::string object_name(Amf::to_string(&opdata->objectName));
@@ -90,7 +89,7 @@ static void ccb_apply_modify_hdlr(const 
                
        std::set<AVD_AVND*>::iterator it;
        for (it = node_set.begin(); it != node_set.end(); ++it) {
-               i = 0;
+               int i = 0;
                while ((attr_mod = opdata->param.modify.attrMods[i++]) != 
nullptr) {
                        AVSV_PARAM_INFO param;
                        const SaImmAttrValuesT_2 *attribute = 
&attr_mod->modAttr;
diff --git a/src/amf/amfd/imm.cc b/src/amf/amfd/imm.cc
--- a/src/amf/amfd/imm.cc
+++ b/src/amf/amfd/imm.cc
@@ -1119,13 +1119,12 @@ static void ccb_abort_cb(SaImmOiHandleT 
 static void ccb_insert_ordered_list(AvdImmOiCcbApplyCallbackT ccb_apply_cb,
                CcbUtilOperationData_t *opdata, AVSV_AMF_CLASS_ID type)
 {
-       AvdCcbApplyOrderedListT *temp = nullptr;
        AvdCcbApplyOrderedListT *prev = nullptr;
        AvdCcbApplyOrderedListT *next = nullptr;
 
        /* allocate memory */
 
-       temp = new AvdCcbApplyOrderedListT;
+       AvdCcbApplyOrderedListT *temp = new AvdCcbApplyOrderedListT;
 
        temp->ccb_apply_cb = ccb_apply_cb;
        temp->opdata = opdata;
@@ -1640,9 +1639,8 @@ unsigned int avd_imm_config_get(void)
 
        // SGs needs to adjust configuration once all instances have been added
        {
-               for (std::map<std::string, AVD_SG*>::const_iterator it = 
sg_db->begin();
-                               it != sg_db->end(); it++) {
-                       AVD_SG *sg = it->second;
+               for (const auto& value : *sg_db) {
+                       AVD_SG *sg = value.second;
                        avd_sg_adjust_config(sg);
                }
        }
@@ -1887,9 +1885,8 @@ void avd_saImmOiRtObjectDelete(const std
 void avd_imm_update_runtime_attrs(void)
 {
        /* Update SU Class runtime cached attributes. */
-       for (std::map<std::string, AVD_SU*>::const_iterator it = su_db->begin();
-                       it != su_db->end(); it++) {
-               AVD_SU *su = it->second;
+       for (const auto& value : *su_db) {
+               AVD_SU *su = value.second;
                avd_saImmOiRtObjectUpdate(su->name, "saAmfSUPreInstantiable",
                        SA_IMM_ATTR_SAUINT32T,  &su->saAmfSUPreInstantiable);
 
@@ -1912,9 +1909,8 @@ void avd_imm_update_runtime_attrs(void)
        }
 
        /* Update Component Class runtime cached attributes. */
-       for (std::map<std::string, AVD_COMP*>::const_iterator it = 
comp_db->begin();
-                       it != comp_db->end(); it++) {
-               AVD_COMP *comp  = it->second;
+       for (const auto& value : *comp_db) {
+               AVD_COMP *comp  = value.second;
                avd_saImmOiRtObjectUpdate(Amf::to_string(&comp->comp_info.name),
                        "saAmfCompReadinessState", SA_IMM_ATTR_SAUINT32T,
                        &comp->saAmfCompReadinessState);
@@ -1930,17 +1926,15 @@ void avd_imm_update_runtime_attrs(void)
        }
 
        /* Update Node Class runtime cached attributes. */
-       for (std::map<std::string, AVD_AVND *>::const_iterator it = 
node_name_db->begin();
-                       it != node_name_db->end(); it++) {
-               AVD_AVND *node = it->second;
+       for (const auto& value : *node_name_db) {
+               AVD_AVND *node = value.second;
                avd_saImmOiRtObjectUpdate(node->name, "saAmfNodeOperState",
                                SA_IMM_ATTR_SAUINT32T, 
&node->saAmfNodeOperState);
        }
 
        /* Update Node Class runtime cached attributes. */
-       for (std::map<std::string, AVD_SI*>::const_iterator it = si_db->begin();
-                       it != si_db->end(); it++) {
-               AVD_SI *si = it->second;
+       for (const auto& value : *si_db) {
+               AVD_SI *si = value.second;
                avd_saImmOiRtObjectUpdate(si->name, "saAmfSIAssignmentState",
                        SA_IMM_ATTR_SAUINT32T, &si->saAmfSIAssignmentState);
        }
@@ -2296,8 +2290,7 @@ done:
 //Imm Object atrribute update related member functions.
 bool ImmObjUpdate::su_get_attr_value() {       
   bool ret = true;
-  AVD_SU *su = nullptr;
-  su = su_db->find(dn);
+  AVD_SU *su = su_db->find(dn);
   if (su == nullptr) {
     TRACE_1("su not found");
     ret = false;
@@ -2351,13 +2344,10 @@ bool ImmObjUpdate::siass_get_attr_value(
 bool ImmObjUpdate::csiass_get_attr_value() {
   std::string comp_name;
   std::string csi_name;
-  AVD_CSI *csi = nullptr;
-  AVD_COMP *comp = nullptr;
-  AVD_COMP_CSI_REL *compcsi = nullptr;
   
//dn:safCSIComp=safComp=AmfDemo\,safSu=SU1\,safSg=AmfDemo\,safApp=AmfDemo1,safCsi=AmfDemo,safSi=AmfDemo,safApp=AmfDemo1
   avd_association_namet_init(dn, comp_name, csi_name, AVSV_SA_AMF_CSI);
-  csi =  csi_db->find(csi_name);
-  comp = comp_db->find(comp_name);
+  AVD_CSI *csi =  csi_db->find(csi_name);
+  AVD_COMP *comp = comp_db->find(comp_name);
   if ((csi == nullptr) || (comp == nullptr)) {
     TRACE_1("comp or csi not found");
     return false;
@@ -2367,6 +2357,8 @@ bool ImmObjUpdate::csiass_get_attr_value
     TRACE_1("susi not found");
     return false;
   }
+
+  AVD_COMP_CSI_REL *compcsi;
   for (compcsi = susi->list_of_csicomp; compcsi; compcsi = 
compcsi->susi_csicomp_next) {
     if ((compcsi->comp == comp) && (compcsi->csi == csi))
       break;
@@ -2384,8 +2376,7 @@ bool ImmObjUpdate::csiass_get_attr_value
   return true;
 }
 bool ImmObjUpdate::comp_get_attr_value() {
-  AVD_COMP *comp = nullptr;
-  comp = comp_db->find(dn);    
+  AVD_COMP *comp = comp_db->find(dn); 
   if (comp == nullptr) {
     TRACE_1("comp not found");
     return false;
@@ -2475,8 +2466,6 @@ bool ImmObjDelete::is_csiass_exist() {
   bool ret = true;
   std::string comp_name;
   std::string csi_name;
-  AVD_CSI *csi = nullptr;
-  AVD_COMP *comp = nullptr;
   AVD_COMP_CSI_REL *compcsi = nullptr; 
   AVD_SU_SI_REL *susi = nullptr;
   
//dn:safCSIComp=safComp=AmfDemo\,safSu=SU1\,safSg=AmfDemo\,safApp=AmfDemo1,safCsi=AmfDemo,safSi=AmfDemo,safApp=AmfDemo1
@@ -2484,8 +2473,8 @@ bool ImmObjDelete::is_csiass_exist() {
   avd_association_namet_init(dn, comp_name, csi_name, AVSV_SA_AMF_CSI);
   TRACE("csi:%s",csi_name.c_str());
   TRACE("comp:%s",comp_name.c_str());
-  csi =  csi_db->find(csi_name);
-  comp = comp_db->find(comp_name);     
+  AVD_CSI *csi =  csi_db->find(csi_name);
+  AVD_COMP *comp = comp_db->find(comp_name);   
   if ((csi == nullptr) || (comp == nullptr)) {
     TRACE_1("comp or csi not found");
     goto done;
diff --git a/src/amf/amfd/main.cc b/src/amf/amfd/main.cc
--- a/src/amf/amfd/main.cc
+++ b/src/amf/amfd/main.cc
@@ -254,8 +254,6 @@ static void standby_invalid_evh(AVD_CL_C
        /* This function should generally never be called
         * log the event to the debug log at information level and return
         */
-       AVD_DND_MSG *n2d_msg;
-
        LOG_IN("avd_standby_invalid_evh: %u", evt->rcv_evt);
 
        if ((evt->rcv_evt >= AVD_EVT_NODE_UP_MSG) && (evt->rcv_evt <= 
AVD_EVT_VERIFY_ACK_NACK_MSG)) {
@@ -264,7 +262,7 @@ static void standby_invalid_evh(AVD_CL_C
                        return;
                }
 
-               n2d_msg = evt->info.avnd_msg;
+               AVD_DND_MSG *n2d_msg = evt->info.avnd_msg;
                avsv_dnd_msg_free(n2d_msg);
                evt->info.avnd_msg = nullptr;
        }
@@ -287,8 +285,6 @@ static void qsd_invalid_evh(AVD_CL_CB *c
        /* This function should generally never be called
         * log the event to the debug log at information level and return
         */
-       AVD_DND_MSG *n2d_msg;
-
        LOG_IN("avd_qsd_invalid_evh: %u", evt->rcv_evt);
 
        /* we need not send sync update to stanby */
@@ -300,7 +296,7 @@ static void qsd_invalid_evh(AVD_CL_CB *c
                        return;
                }
 
-               n2d_msg = evt->info.avnd_msg;
+               AVD_DND_MSG *n2d_msg = evt->info.avnd_msg;
                avsv_dnd_msg_free(n2d_msg);
                evt->info.avnd_msg = nullptr;
        }
@@ -320,10 +316,7 @@ static void qsd_invalid_evh(AVD_CL_CB *c
 static void qsd_ignore_evh(AVD_CL_CB *cb, AVD_EVT *evt)
 {
        /* Ignore this Event. Free this msg */
-       AVD_DND_MSG *n2d_msg;
-
        LOG_IN("avd_qsd_ignore_evh: %u", evt->rcv_evt);
-
        /* we need not send sync update to stanby */
        cb->sync_required = false;
 
@@ -333,7 +326,7 @@ static void qsd_ignore_evh(AVD_CL_CB *cb
                        return;
                }
 
-               n2d_msg = evt->info.avnd_msg;
+               AVD_DND_MSG *n2d_msg = evt->info.avnd_msg;
                avsv_dnd_msg_free(n2d_msg);
                evt->info.avnd_msg = nullptr;
        }
@@ -402,8 +395,6 @@ static void handle_event_in_failover_sta
 
        std::map<uint32_t, AVD_FAIL_OVER_NODE *>::const_iterator it = 
node_list_db->begin();
        if (it == node_list_db->end()) {
-               AVD_EVT_QUEUE *queue_evt;
-
                /* We have received the info from all the nodes. */
                cb->avd_fover_state = false;
 
@@ -411,7 +402,7 @@ static void handle_event_in_failover_sta
                   and process them now */
 
                while (!cb->evt_queue.empty()) {
-                       queue_evt = cb->evt_queue.front();
+                       AVD_EVT_QUEUE *queue_evt = cb->evt_queue.front();
                        cb->evt_queue.pop();
                        process_event(cb, queue_evt->evt);
                        delete queue_evt;
@@ -426,8 +417,8 @@ static void handle_event_in_failover_sta
                                it != node_id_db->end();) {
                        AVD_AVND *node = it->second;
                        ++it;
-                       bool fover_done = false;
                        if (AVD_AVND_STATE_ABSENT == node->node_state) {
+                               bool fover_done = false;
                                /* Check whether this node failover has been
                                   performed or not. */
                                for (const auto& i_su : node->list_of_ncs_su) {
diff --git a/src/amf/amfd/mds.cc b/src/amf/amfd/mds.cc
--- a/src/amf/amfd/mds.cc
+++ b/src/amf/amfd/mds.cc
@@ -502,12 +502,10 @@ static uint32_t avd_mds_svc_evt(MDS_CALL
 ******************************************************************************/
 static uint32_t avd_mds_qsd_ack_evt(MDS_CALLBACK_QUIESCED_ACK_INFO *evt_info)
 {
-       AVD_EVT *evt = AVD_EVT_NULL;
        AVD_CL_CB *cb = avd_cb;
-
        TRACE_ENTER();
 
-       evt = new AVD_EVT();
+       AVD_EVT *evt = new AVD_EVT();
 
        evt->rcv_evt = AVD_EVT_MDS_QSD_ACK;
 
diff --git a/src/amf/amfd/ndfsm.cc b/src/amf/amfd/ndfsm.cc
--- a/src/amf/amfd/ndfsm.cc
+++ b/src/amf/amfd/ndfsm.cc
@@ -112,18 +112,16 @@ void avd_process_state_info_queue(AVD_CL
        // Otherwise, amfd is coming from SC recovery from headless, SI alarm 
state
        // should be re-evalutated and raise the alarm in case it's still 
unassigned.
        if (queue_size == 0) {
-               for (std::map<std::string, AVD_SI*>::const_iterator it = 
si_db->begin();
-                               it != si_db->end(); it++) {
-                       AVD_SI *si = it->second;
+               for (const auto& value : *si_db) {
+                       AVD_SI *si = value.second;
                        if (si->alarm_sent == true) {
                                si->update_alarm_state(false, false);
                        }
                }
        }
        else {
-               for (std::map<std::string, AVD_SI*>::const_iterator it = 
si_db->begin();
-                               it != si_db->end(); it++) {
-                       AVD_SI *si = it->second;
+               for (const auto& value : *si_db) {
+                       AVD_SI *si = value.second;
                        if (si->alarm_sent == false &&
                                        si->saAmfSIAssignmentState == 
SA_AMF_ASSIGNMENT_UNASSIGNED) {
                                si->update_alarm_state(true);
@@ -173,9 +171,8 @@ uint32_t avd_count_sync_node_size(AVD_CL
        uint32_t count = 0;
        TRACE_ENTER();
 
-       for (std::map<std::string, AVD_AVND *>::const_iterator it = 
node_name_db->begin();
-                       it != node_name_db->end(); it++) {
-               AVD_AVND *avnd = it->second;
+       for (const auto& value : *node_name_db) {
+               AVD_AVND *avnd = value.second;
                osafassert(avnd);
                for (const auto& su :avnd->list_of_ncs_su) {
                        if (su->sg_of_su->sg_redundancy_model == 
SA_AMF_2N_REDUNDANCY_MODEL) {
@@ -221,9 +218,8 @@ uint32_t avd_count_node_up(AVD_CL_CB *cb
 
        TRACE_ENTER();
 
-       for (std::map<std::string, AVD_AVND *>::const_iterator it = 
node_name_db->begin();
-                       it != node_name_db->end(); it++) {
-               node = it->second;
+for (const auto& value : *node_name_db) {
+               node = value.second;
                if (node->node_up_msg_count > 0
                                && node->node_info.nodeId != cb->node_id_avd
                                && node->node_info.nodeId != 
cb->node_id_avd_other)
@@ -737,9 +733,8 @@ void avd_mds_avnd_down_evh(AVD_CL_CB *cb
                /* Find if node is there in the f-over node list.
                 * If yes then remove entry
                 */
-               for (std::map<uint32_t, AVD_FAIL_OVER_NODE *>::const_iterator 
it = node_list_db->begin();
-                               it != node_list_db->end(); it++) {
-                       AVD_FAIL_OVER_NODE *node_fovr = it->second;
+               for (const auto& value : *node_list_db) {
+                       AVD_FAIL_OVER_NODE *node_fovr = value.second;
                        if (node_fovr->node_id == evt->info.node_id) {
                                node_list_db->erase(node_fovr->node_id);
                                delete node_fovr;
@@ -773,9 +768,8 @@ void avd_fail_over_event(AVD_CL_CB *cb)
        cb->avd_fover_state = true;
 
        /* Walk through all the nodes and send verify message to them. */
-       for (std::map<uint32_t, AVD_AVND *>::const_iterator it = 
node_id_db->begin();
-                       it != node_id_db->end(); it++) {
-               AVD_AVND *avnd = it->second;
+       for (const auto& value : *node_id_db) {
+               AVD_AVND *avnd = value.second;
                node_id = avnd->node_info.nodeId;
 
                /*
@@ -861,9 +855,8 @@ void avd_ack_nack_evh(AVD_CL_CB *cb, AVD
        /* Find if node is there in the f-over node list. If yes then remove 
entry
         * and process the message. Else just return.
         */
-       for (std::map<uint32_t, AVD_FAIL_OVER_NODE *>::const_iterator it = 
node_list_db->begin();
-                       it != node_list_db->end(); it++) {
-               AVD_FAIL_OVER_NODE *node_fovr = it->second;
+       for (const auto& value : *node_list_db) {
+               AVD_FAIL_OVER_NODE *node_fovr = value.second;
                if (node_fovr->node_id == evt->info.avnd_msg->msg_info.
                                n2d_ack_nack_info.node_id) {
                        node_found = true;
diff --git a/src/amf/amfd/ndproc.cc b/src/amf/amfd/ndproc.cc
--- a/src/amf/amfd/ndproc.cc
+++ b/src/amf/amfd/ndproc.cc
@@ -314,7 +314,6 @@ void avd_oper_req_evh(AVD_CL_CB *cb, AVD
 void avd_nd_sisu_state_info_evh(AVD_CL_CB *cb, AVD_EVT *evt)
 {
        AVD_DND_MSG *n2d_msg = evt->info.avnd_msg;
-       AVD_EVT_QUEUE* state_info_evt;
 
        TRACE_ENTER();
        LOG_NO("Receive message with event type:%u, msg_type:%u, from node:%x, 
msg_id:%u",
@@ -324,7 +323,7 @@ void avd_nd_sisu_state_info_evh(AVD_CL_C
                        
evt->info.avnd_msg->msg_info.n2d_nd_sisu_state_info.msg_id);
 
        if (cb->node_sync_window_closed == false) {
-               state_info_evt = new AVD_EVT_QUEUE();
+               AVD_EVT_QUEUE *state_info_evt = new AVD_EVT_QUEUE();
                state_info_evt->evt = new AVD_EVT{};
                state_info_evt->evt->rcv_evt = evt->rcv_evt;
                state_info_evt->evt->info.avnd_msg = n2d_msg;
@@ -358,7 +357,6 @@ void avd_nd_sisu_state_info_evh(AVD_CL_C
 void avd_nd_compcsi_state_info_evh(AVD_CL_CB *cb, AVD_EVT *evt)
 {
        AVD_DND_MSG *n2d_msg = evt->info.avnd_msg;
-       AVD_EVT_QUEUE* state_info_evt;
 
        TRACE_ENTER();
        LOG_NO("Receive message with event type:%u, msg_type:%u, from node:%x, 
msg_id:%u",
@@ -368,7 +366,7 @@ void avd_nd_compcsi_state_info_evh(AVD_C
                        
evt->info.avnd_msg->msg_info.n2d_nd_csicomp_state_info.msg_id);
 
        if (cb->node_sync_window_closed == false) {
-               state_info_evt = new AVD_EVT_QUEUE();
+               AVD_EVT_QUEUE *state_info_evt = new AVD_EVT_QUEUE();
                state_info_evt->evt = new AVD_EVT{};
                state_info_evt->evt->rcv_evt = evt->rcv_evt;
                state_info_evt->evt->info.avnd_msg = n2d_msg;
@@ -731,9 +729,8 @@ bool cluster_su_instantiation_done(AVD_C
 
 node_walk:
 
-       for (std::map<std::string, AVD_AVND *>::const_iterator it = 
node_name_db->begin();
-                       it != node_name_db->end(); it++) {
-               node = it->second;
+       for (const auto& value : *node_name_db) {
+               node = value.second;
                TRACE("node name '%s', Oper'%u'", node->name.c_str(), 
node->saAmfNodeOperState);
                if (node->saAmfNodeOperState == SA_AMF_OPERATIONAL_ENABLED)
                {
@@ -1098,9 +1095,7 @@ void avd_comp_validation_evh(AVD_CL_CB *
        AVD_DND_MSG *n2d_msg = evt->info.avnd_msg;
        uint32_t res = NCSCC_RC_SUCCESS;
        AVD_AVND *node;
-       AVSV_N2D_COMP_VALIDATION_INFO *valid_info = nullptr;
-
-       valid_info = &n2d_msg->msg_info.n2d_comp_valid_info;
+       AVSV_N2D_COMP_VALIDATION_INFO *valid_info = 
&n2d_msg->msg_info.n2d_comp_valid_info;
 
        TRACE_ENTER2("%s", osaf_extended_name_borrow(&valid_info->comp_name));
 
diff --git a/src/amf/amfd/node.cc b/src/amf/amfd/node.cc
--- a/src/amf/amfd/node.cc
+++ b/src/amf/amfd/node.cc
@@ -46,12 +46,10 @@ bool NodeNameCompare::operator() (const 
 
 uint32_t avd_node_add_nodeid(AVD_AVND *node)
 {
-       unsigned int rc;
-
        if ((node_id_db->find(node->node_info.nodeId) == nullptr) &&
                        (node->node_info.nodeId != 0)) {
                TRACE("added node %d", node->node_info.nodeId);
-               rc = node_id_db->insert(node->node_info.nodeId, node);
+               unsigned int rc = node_id_db->insert(node->node_info.nodeId, 
node);
                osafassert(rc == NCSCC_RC_SUCCESS);
        }
 
@@ -65,12 +63,11 @@ void avd_node_delete_nodeid(AVD_AVND *no
 
 void avd_node_db_add(AVD_AVND *node)
 {
-       unsigned int rc;
        TRACE_ENTER();
 
        if (node_name_db->find(node->name) == nullptr) {
                TRACE("add %s", node->name.c_str());
-               rc = node_name_db->insert(node->name, node);
+               unsigned int rc = node_name_db->insert(node->name, node);
                osafassert(rc == NCSCC_RC_SUCCESS);
        }
        TRACE_LEAVE();
@@ -197,7 +194,7 @@ void avd_node_delete(AVD_AVND *node)
                                                        delete compcstype;
                                                }
                                                else
-                                                       it++;
+                                                       ++it;
                                        }
 
 
@@ -578,9 +575,8 @@ static SaAisErrorT node_ccb_completed_de
 
        /* This node shouldn't be part of any nodegroup. First this node has to 
be deleted from
           node group. */
-       for (std::map<std::string, AVD_AMF_NG*>::const_iterator it = 
nodegroup_db->begin();
-                       it != nodegroup_db->end(); it++) {
-               AVD_AMF_NG *ng = it->second;
+       for (const auto& value : *nodegroup_db) {
+               AVD_AMF_NG *ng = value.second;
 
                if (node_in_nodegroup(Amf::to_string(&(opdata->objectName)), 
ng) == true) {
                        // if the node is being removed from nodegroup too, 
then it's OK
@@ -1551,9 +1547,8 @@ void node_reset_su_try_inst_counter(cons
  */
 bool are_all_ngs_in_unlocked_state(const AVD_AVND *node)
 {
-        for (std::map<std::string, AVD_AMF_NG*>::const_iterator it = 
nodegroup_db->begin();
-                        it != nodegroup_db->end(); it++) {
-                AVD_AMF_NG *ng = it->second;
+       for (const auto& value : *nodegroup_db) {
+               AVD_AMF_NG *ng = value.second;
                 if ((node_in_nodegroup(node->name, ng) == true) &&
                                 (ng->saAmfNGAdminState != 
SA_AMF_ADMIN_UNLOCKED))
                         return false;
@@ -1567,9 +1562,8 @@ bool are_all_ngs_in_unlocked_state(const
  */
 bool any_ng_in_locked_in_state(const AVD_AVND *node)
 {
-       for (std::map<std::string, AVD_AMF_NG*>::const_iterator it = 
nodegroup_db->begin();
-                       it != nodegroup_db->end(); it++) {
-               AVD_AMF_NG *ng = it->second;
+       for (const auto& value : *nodegroup_db) {
+               AVD_AMF_NG *ng = value.second;
                if ((node_in_nodegroup(node->name, ng) == true) &&
                                (ng->saAmfNGAdminState == 
SA_AMF_ADMIN_LOCKED_INSTANTIATION)) {
                        TRACE("Nodegroup '%s' is in locked-in", 
ng->name.c_str());
diff --git a/src/amf/amfd/nodegroup.cc b/src/amf/amfd/nodegroup.cc
--- a/src/amf/amfd/nodegroup.cc
+++ b/src/amf/amfd/nodegroup.cc
@@ -220,9 +220,8 @@ SaAisErrorT avd_ng_config_get(void)
 
        /* Could be here as a consequence of a fail/switch-over. Delete the DB
        ** since it is anyway not synced and needs to be rebuilt. */
-       for (std::map<std::string, AVD_AMF_NG*>::const_iterator it = 
nodegroup_db->begin();
-                       it != nodegroup_db->end(); it++) {
-               AVD_AMF_NG *ng = it->second;
+       for (const auto& value : *nodegroup_db) {
+               AVD_AMF_NG *ng = value.second;
                ng_delete(ng);
        }
 
@@ -1403,9 +1402,8 @@ void avd_ng_restore_headless_states(AVD_
                if (susi->state == SA_AMF_HA_QUIESCED || susi->state == 
SA_AMF_HA_QUIESCING ||
                                susi->fsm == AVD_SU_SI_STATE_UNASGN) {
 
-               for (std::map<std::string, AVD_AMF_NG*>::const_iterator it = 
nodegroup_db->begin();
-                       it != nodegroup_db->end(); it++) {
-                       AVD_AMF_NG *ng = it->second;
+                       for (const auto& value : *nodegroup_db) {
+                               AVD_AMF_NG *ng = value.second;
                        for (std::set<std::string>::const_iterator iter = 
ng->saAmfNGNodeList.begin();
                                        iter != ng->saAmfNGNodeList.end(); 
++iter) {
                                AVD_AVND *node = avd_node_get(*iter);
diff --git a/src/amf/amfd/role.cc b/src/amf/amfd/role.cc
--- a/src/amf/amfd/role.cc
+++ b/src/amf/amfd/role.cc
@@ -691,9 +691,8 @@ static void reset_admin_op_params_after_
 {
        TRACE_ENTER();
        //For ng.
-       for (std::map<std::string, AVD_AMF_NG*>::const_iterator it = 
nodegroup_db->begin();
-                       it != nodegroup_db->end(); it++) {
-               AVD_AMF_NG *ng = it->second;
+       for (const auto& value : *nodegroup_db) {
+               AVD_AMF_NG *ng = value.second;
                if (ng->admin_ng_pend_cbk.invocation != 0) {
                        ng->admin_ng_pend_cbk.invocation = 0;
                        ng->admin_ng_pend_cbk.admin_oper = 
static_cast<SaAmfAdminOperationIdT>(0);
@@ -705,29 +704,25 @@ static void reset_admin_op_params_after_
                }
        }
        //For Node.
-       for (std::map<uint32_t, AVD_AVND *>::const_iterator it = 
node_id_db->begin();
-                       it != node_id_db->end(); it++) {
-               AVD_AVND *node = it->second;
+       for (const auto& value : *node_id_db) {
+               AVD_AVND *node = value.second;
                node->admin_node_pend_cbk.invocation = 0;
                node->admin_node_pend_cbk.admin_oper = 
static_cast<SaAmfAdminOperationIdT>(0);
        }
        //For SI.
-       for (std::map<std::string, AVD_SI*>::const_iterator it = si_db->begin();
-                       it != si_db->end(); it++) {
-               AVD_SI *si = it->second;
+       for (const auto& value : *si_db) {
+               AVD_SI *si = value.second;
                si->invocation = 0;
        }
        //For SG.
-       for (std::map<std::string, AVD_SG*>::const_iterator it = sg_db->begin();
-                       it != sg_db->end(); it++) {
-               AVD_SG *sg = it->second;
+       for (const auto& value : *sg_db) {
+               AVD_SG *sg = value.second;
                sg->adminOp_invocationId = 0;
                sg->adminOp = static_cast<SaAmfAdminOperationIdT>(0);
        }
        //For SU.
-       for (std::map<std::string, AVD_SU*>::const_iterator it = su_db->begin();
-                       it != su_db->end(); it++) {
-               AVD_SU *su = it->second;
+       for (const auto& value : *su_db) {
+               AVD_SU *su = value.second;
                su->pend_cbk.invocation = 0;
                 su->pend_cbk.admin_oper = 
static_cast<SaAmfAdminOperationIdT>(0);
 
@@ -852,8 +847,6 @@ try_again:
 
 void amfd_switch(AVD_CL_CB *cb)
 {
-       AVD_AVND *avnd = nullptr;  
-
        TRACE_ENTER();
 
        LOG_NO("Controller switch over initiated");
@@ -861,7 +854,7 @@ void amfd_switch(AVD_CL_CB *cb)
 
        /* First check if there are any other SI's that are any other active */
        /* get the avnd from node_id */
-       avnd = avd_node_find_nodeid(cb->node_id_avd);
+       AVD_AVND *avnd = avd_node_find_nodeid(cb->node_id_avd);
 
        for (const auto& i_su : avnd->list_of_ncs_su) {
                if ((i_su->list_of_susi != 0) &&
@@ -900,7 +893,6 @@ void amfd_switch(AVD_CL_CB *cb)
 
 uint32_t avd_post_amfd_switch_role_change_evt(AVD_CL_CB *cb, SaAmfHAStateT 
role)
 {
-       uint32_t rc = NCSCC_RC_SUCCESS;
        AVD_EVT *evt;
 
        evt = new AVD_EVT;
@@ -911,7 +903,7 @@ uint32_t avd_post_amfd_switch_role_chang
        evt->info.avd_msg->msg_info.d2d_chg_role_req.cause = AVD_SWITCH_OVER;
        evt->info.avd_msg->msg_info.d2d_chg_role_req.role =  role; 
 
-       rc = ncs_ipc_send(&avd_cb->avd_mbx, (NCS_IPC_MSG *)evt, 
static_cast<NCS_IPC_PRIORITY>(MDS_SEND_PRIORITY_HIGH));
+       uint32_t rc = ncs_ipc_send(&avd_cb->avd_mbx, (NCS_IPC_MSG *)evt, 
static_cast<NCS_IPC_PRIORITY>(MDS_SEND_PRIORITY_HIGH));
        osafassert(rc == NCSCC_RC_SUCCESS);
        return rc;
 }
@@ -1120,9 +1112,8 @@ uint32_t amfd_switch_qsd_stdby(AVD_CL_CB
        }
 
        /* Walk through all the nodes and  free PG records. */
-       for (std::map<uint32_t, AVD_AVND *>::const_iterator it = 
node_id_db->begin();
-                       it != node_id_db->end(); it++) {
-               AVD_AVND *avnd = it->second;
+       for (const auto& value : *node_id_db) {
+               AVD_AVND *avnd = value.second;
                avd_pg_node_csi_del_all(cb, avnd);
        }
 
@@ -1273,9 +1264,8 @@ uint32_t amfd_switch_stdby_actv(AVD_CL_C
 
        avd_act_on_sis_in_tol_timer_state();
        /* Screen through all the SG's in the sg database and update si's 
si_dep_state */
-       for (std::map<std::string, AVD_SG*>::const_iterator it = sg_db->begin();
-                       it != sg_db->end(); it++) {
-               AVD_SG *sg = it->second;
+       for (const auto& value : *sg_db) {
+               AVD_SG *sg = value.second;
                if (sg->sg_fsm_state == AVD_SG_FSM_STABLE) {
                        avd_sidep_update_si_dep_state_for_all_sis(sg);
                        avd_sidep_sg_take_action(sg);
diff --git a/src/amf/amfd/sg.cc b/src/amf/amfd/sg.cc
--- a/src/amf/amfd/sg.cc
+++ b/src/amf/amfd/sg.cc
@@ -39,10 +39,8 @@ static void avd_verify_equal_ranked_su(A
 
 void avd_sg_db_add(AVD_SG *sg)
 {
-       unsigned int rc;
-
        if (sg_db->find(sg->name) == nullptr) {
-               rc = sg_db->insert(sg->name,sg);
+               unsigned int rc = sg_db->insert(sg->name,sg);
                osafassert(rc == NCSCC_RC_SUCCESS);
        }
 }
@@ -262,7 +260,6 @@ static int is_config_valid(const std::st
 
 static AVD_SG *sg_create(const std::string& sg_name, const SaImmAttrValuesT_2 
**attributes)
 {
-       int rc = -1;
        AVD_SG *sg;
        AVD_AMF_SG_TYPE *sgt;
        SaAisErrorT error;
@@ -389,13 +386,6 @@ static AVD_SG *sg_create(const std::stri
        /*  TODO use value in type instead? */
        sg->sg_redundancy_model = sgt->saAmfSgtRedundancyModel;
 
-       rc = 0;
-
-       if (rc != 0) {
-               avd_sg_delete(sg);
-               sg = nullptr;
-       }
-
        TRACE_LEAVE();
        return sg;
 }
@@ -637,7 +627,7 @@ static SaAisErrorT ccb_completed_modify_
                                if (value_is_deleted == true)
                                        continue;
                                uint32_t sg_autorepair = *((SaUint32T 
*)attribute->attrValues[0]);
-                               if (sg_autorepair > true ) {
+                               if (sg_autorepair > 1) {
                                        report_ccb_validation_error(opdata,
                                                "Invalid saAmfSGAutoRepair 
SG:'%s'", sg->name.c_str());
                                        rc = SA_AIS_ERR_BAD_OPERATION;
@@ -926,7 +916,6 @@ static void ccb_apply_modify_hdlr(CcbUti
                                else
                                        sg->saAmfSGAutoAdjust = 
static_cast<SaBoolT>(*((SaUint32T *)value));
                                TRACE("Modified saAmfSGAutoAdjust is '%u'", 
sg->saAmfSGAutoAdjust);
-                       } else if (!strcmp(attribute->attrName, 
"saAmfSGAutoAdjust")) {
                        } else if (!strcmp(attribute->attrName, 
"saAmfSGNumPrefActiveSUs")) {
                                if (value_is_deleted)
                                        sg->saAmfSGNumPrefActiveSUs = 1;
@@ -1142,11 +1131,10 @@ static void ccb_apply_modify_hdlr(CcbUti
 uint32_t AVD_SG::term_su_list_in_reverse()
 {
        uint32_t rc = NCSCC_RC_SUCCESS;
-       AVD_SU *su;
 
        TRACE_ENTER2("sg: %s", this->name.c_str());
        for (auto iter = list_of_su.rbegin(); iter != list_of_su.rend(); 
++iter) {
-               su = *iter;
+               AVD_SU *su = *iter;
                TRACE("terminate su:'%s'", su ? su->name.c_str() : nullptr);
 
                if ((su->saAmfSUPreInstantiable == true) &&
@@ -2199,9 +2187,8 @@ done:
 bool avd_sg_validate_headless_cached_rta(AVD_CL_CB *cb) {
        TRACE_ENTER();
        bool valid = true;
-       for (std::map<std::string, AVD_SG*>::const_iterator it = sg_db->begin();
-                       it != sg_db->end(); it++) {
-               AVD_SG *i_sg = it->second;
+       for (const auto& value : *sg_db) {
+               AVD_SG *i_sg = value.second;
                if (i_sg->sg_ncs_spec == true) {
                        continue;
                }
diff --git a/src/amf/amfd/sg_2n_fsm.cc b/src/amf/amfd/sg_2n_fsm.cc
--- a/src/amf/amfd/sg_2n_fsm.cc
+++ b/src/amf/amfd/sg_2n_fsm.cc
@@ -2786,8 +2786,7 @@ uint32_t SG_2N::realign(AVD_CL_CB *cb, A
 }
 
 void SG_2N::node_fail_su_oper(AVD_SU *su) {
-       AVD_SU_SI_REL *a_susi, *s_susi, *s_susi_temp;
-       AVD_SU *o_su;
+       AVD_SU_SI_REL *s_susi, *s_susi_temp;
        AVD_AVND *su_node_ptr = nullptr;
        AVD_CL_CB *cb = avd_cb;
 
@@ -2796,7 +2795,7 @@ void SG_2N::node_fail_su_oper(AVD_SU *su
 
        if (su_oper_list_front() == su) {
                /* the SU is same as the SU in the list */
-               a_susi = avd_sg_2n_act_susi(cb, su->sg_of_su, &s_susi);
+               AVD_SU_SI_REL *a_susi = avd_sg_2n_act_susi(cb, su->sg_of_su, 
&s_susi);
                /* If node fail happens while quiesced or qioescing role 
modification is in progress
                 * there is possibility that all the susi wont be in quiesced 
or quiescing state
                 * so when checking whether SU is in quiesced or quiescing 
assignment processing
@@ -2835,6 +2834,7 @@ void SG_2N::node_fail_su_oper(AVD_SU *su
                                avd_sg_su_oper_list_del(cb, su, false);
                                su->delete_all_susis();
                                su->sg_of_su->set_fsm_state(AVD_SG_FSM_STABLE);
+                               AVD_SU *o_su;
                                if ((o_su = avd_sg_2n_su_chose_asgn(cb, 
su->sg_of_su)) != nullptr) {
                                        /* add the SU to the operation list and 
change the SG FSM to SG realign. */
                                        avd_sg_su_oper_list_add(cb, o_su, 
false);
@@ -3965,8 +3965,8 @@ void SG_2N::ng_admin(AVD_SU *su, AVD_AMF
                avd_sg_app_su_inst_func(avd_cb, su->sg_of_su);
                return;
        }
-       AVD_SU_SI_REL *s_susi = nullptr, *a_susi = nullptr;
-       a_susi = avd_sg_2n_act_susi(avd_cb, sg, &s_susi);
+       AVD_SU_SI_REL *s_susi = nullptr;
+       AVD_SU_SI_REL *a_susi = avd_sg_2n_act_susi(avd_cb, sg, &s_susi);
 
        if ((sg->is_sg_assigned_only_in_ng(ng) == true) && (s_susi != nullptr)) 
{
                AVD_AVND *actv_node = a_susi->su->su_on_node;
diff --git a/src/amf/amfd/sg_nored_fsm.cc b/src/amf/amfd/sg_nored_fsm.cc
--- a/src/amf/amfd/sg_nored_fsm.cc
+++ b/src/amf/amfd/sg_nored_fsm.cc
@@ -108,7 +108,6 @@ uint32_t SG_NORED::si_assign(AVD_CL_CB *
 }
 
 uint32_t SG_NORED::su_fault(AVD_CL_CB *cb, AVD_SU *su) {
-       bool flag;
        AVD_AVND *su_node_ptr = nullptr;
 
        TRACE_ENTER2("%u", su->sg_of_su->sg_fsm_state);
@@ -145,7 +144,7 @@ uint32_t SG_NORED::su_fault(AVD_CL_CB *c
                        su_oper_list_add(su);
                        m_AVD_CLEAR_SG_ADMIN_SI(cb, (su->sg_of_su));
                } else {        /* if (su->list_of_susi->si == 
su->sg_of_su->admin_si) */
-
+                       bool flag;
                        m_AVD_CHK_OPLIST(su, flag);
                        if (flag == true) {
                                /* The SU is same as the SU in the list. If the 
HA state assignment
diff --git a/src/amf/amfd/sg_npm_fsm.cc b/src/amf/amfd/sg_npm_fsm.cc
--- a/src/amf/amfd/sg_npm_fsm.cc
+++ b/src/amf/amfd/sg_npm_fsm.cc
@@ -1068,11 +1068,11 @@ uint32_t SG_NPM::su_fault_su_oper(AVD_CL
 uint32_t SG_NPM::su_fault_si_oper(AVD_CL_CB *cb, AVD_SU *su)
 {
        AVD_SU_SI_REL *l_susi;
-       bool l_flag;
        AVD_SU *o_su;
 
        if ((l_susi = avd_su_susi_find(cb, su, su->sg_of_su->admin_si->name))
            == AVD_SU_SI_REL_NULL) {
+               bool l_flag;
                /* SI doesn't have any assignment with the SU */
                m_AVD_CHK_OPLIST(su, l_flag);
                if (l_flag == true) {
@@ -1260,7 +1260,6 @@ uint32_t SG_NPM::su_fault_si_oper(AVD_CL
 
 uint32_t SG_NPM::su_fault_sg_relgn(AVD_CL_CB *cb, AVD_SU *su)
 {
-       bool l_flag = false;
        AVD_AVND *su_node_ptr = nullptr;
 
        if (su->sg_of_su->admin_si != AVD_SI_NULL) {
@@ -1290,7 +1289,7 @@ uint32_t SG_NPM::su_fault_sg_relgn(AVD_C
                                m_AVSV_SEND_CKPT_UPDT_ASYNC_RMV(cb, 
su->sg_of_su, AVSV_CKPT_AVD_SI_TRANS);
                        }
                }
-
+               bool l_flag = false;
                m_AVD_CHK_OPLIST(su, l_flag);
                if (l_flag == true) {
                        /* If the fault happened while role failover is under 
progress,then for all the dependent SI's
@@ -1388,7 +1387,6 @@ uint32_t SG_NPM::su_fault_sg_relgn(AVD_C
 }
 
 uint32_t SG_NPM::su_fault(AVD_CL_CB *cb, AVD_SU *su) {
-       AVD_SU_SI_REL *a_susi;
 
        TRACE_ENTER2("%u", su->sg_of_su->sg_fsm_state);
 
@@ -1454,6 +1452,7 @@ uint32_t SG_NPM::su_fault(AVD_CL_CB *cb,
                         * SU and add it to the SU operlist. 
                         */
                        if (su->list_of_susi->state == SA_AMF_HA_QUIESCING) {
+                               AVD_SU_SI_REL *a_susi;
                                a_susi = avd_sg_npm_su_othr(cb, su);
                                if (avd_sg_su_si_mod_snd(cb, su, 
SA_AMF_HA_QUIESCED) == NCSCC_RC_FAILURE) {
                                        LOG_ER("%s:%u: %s (%zu)", __FILE__, 
__LINE__, su->name.c_str(), su->name.length());
@@ -1554,7 +1553,6 @@ uint32_t SG_NPM::susi_sucss_sg_reln(AVD_
                                           AVSV_SUSI_ACT act, SaAmfHAStateT 
state)
 {
        AVD_SU_SI_REL *i_susi, *o_susi;
-       bool flag, fover_progress = false;
        AVD_AVND *su_node_ptr = nullptr;
 
        TRACE_ENTER();
@@ -1563,7 +1561,7 @@ uint32_t SG_NPM::susi_sucss_sg_reln(AVD_
                /* assign all */
                if ((act == AVSV_SUSI_ACT_MOD) && (state == 
SA_AMF_HA_QUIESCED)) {
                        /* quiesced all */
-
+                       bool flag;
                        if (su->sg_of_su->admin_si != AVD_SI_NULL) {
                                /* SI in admin pointer */
                                if ((su->sg_of_su->admin_si->si_switch == 
AVSV_SI_TOGGLE_SWITCH)
@@ -1702,6 +1700,7 @@ uint32_t SG_NPM::susi_sucss_sg_reln(AVD_
 
                } /* if ((act == AVSV_SUSI_ACT_MOD) && (state == 
SA_AMF_HA_QUIESCED)) */
                else if (act == AVSV_SUSI_ACT_DEL) {
+                       bool fover_progress = false;
                        /* remove all */
                        if (su->list_of_susi->state == SA_AMF_HA_QUIESCED) {
                                o_susi = avd_sg_npm_su_othr(cb, su);
@@ -2222,15 +2221,12 @@ static void avd_sg_npm_screening_for_si_
  */
 static void avd_sg_npm_si_transfer_for_redistr(AVD_SG *avd_sg)
 {
-        AVD_SU_SI_REL *susi = nullptr;
-
        TRACE_ENTER2("SG name:%s SI name:%s", 
avd_sg->name.c_str(),avd_sg->si_tobe_redistributed->name.c_str());
-
        /* checkpoint the SI transfer parameters with STANDBY*/
        m_AVSV_SEND_CKPT_UPDT_ASYNC_ADD(avd_cb, avd_sg, AVSV_CKPT_AVD_SI_TRANS);
 
         /* Find the su_si corresponding to max_assign_su & 
si_tobe_redistributed */
-        susi = avd_su_susi_find(avd_cb, avd_sg->max_assigned_su, 
avd_sg->si_tobe_redistributed->name);
+        AVD_SU_SI_REL *susi = avd_su_susi_find(avd_cb, 
avd_sg->max_assigned_su, avd_sg->si_tobe_redistributed->name);
         if( susi == AVD_SU_SI_REL_NULL ) {
                 /* No assignments for this SU corresponding to the SI to be 
swapped*/
                 LOG_ER("Failed to find the susi %s:%u: SU:%s SI:%s", 
__FILE__,__LINE__,
@@ -2457,7 +2453,6 @@ uint32_t SG_NPM::susi_success_su_oper(AV
        AVD_SU_SI_REL *i_susi;
        AVD_SU_SI_REL *o_susi;
        AVD_SU_SI_REL *tmp_susi;
-       bool susi_assgn_failed = false;
        
        AVD_AVND *su_node_ptr = nullptr;
 
@@ -2473,6 +2468,7 @@ uint32_t SG_NPM::susi_success_su_oper(AV
                                /* SI Transfer flow, got response for 
max_assigned_su quiesced opr, if min_assigned_su
                                   is in in_service send Active assignment to 
it else revert back Active assignment to
                                   max_assigned_su */
+                               bool susi_assgn_failed = false;
                                if 
(su->sg_of_su->min_assigned_su->saAmfSuReadinessState == 
                                                                
SA_AMF_READINESS_IN_SERVICE) {
                                        TRACE("Assigning active for SI:%s to 
SU:%s",
@@ -2828,7 +2824,6 @@ static uint32_t avd_sg_npm_susi_sucss_si
 
 uint32_t SG_NPM::susi_success(AVD_CL_CB *cb, AVD_SU *su, AVD_SU_SI_REL *susi,
                AVSV_SUSI_ACT act, SaAmfHAStateT state) {
-       AVD_SU_SI_REL *o_susi;
 
        TRACE_ENTER2("%u", su->sg_of_su->sg_fsm_state);
 
@@ -2879,7 +2874,7 @@ uint32_t SG_NPM::susi_success(AVD_CL_CB 
                                 * standby and send a D2N-INFO_SU_SI_ASSIGN 
with remove all for 
                                 * that SU and add it to the SU oper list.
                                 */
-                               o_susi = avd_sg_npm_su_othr(cb, su);
+                               AVD_SU_SI_REL *o_susi = avd_sg_npm_su_othr(cb, 
su);
                                if ((o_susi != AVD_SU_SI_REL_NULL) && 
(o_susi->fsm != AVD_SU_SI_STATE_UNASGN)) {
                                        avd_sg_su_si_del_snd(cb, o_susi->su);
                                        avd_sg_su_oper_list_add(cb, o_susi->su, 
false);
@@ -3783,7 +3778,7 @@ void SG_NPM::node_fail_su_oper(AVD_CL_CB
 
 void SG_NPM::node_fail_si_oper(AVD_CL_CB *cb, AVD_SU *su)
 {
-       AVD_SU_SI_REL *l_susi, *o_susi, *ot_susi;
+       AVD_SU_SI_REL *l_susi, *o_susi;
        
        osafassert(this == su->sg_of_su);
 
@@ -3804,7 +3799,7 @@ void SG_NPM::node_fail_si_oper(AVD_CL_CB
                if (su->list_of_susi->state == SA_AMF_HA_ACTIVE) {
                        /* The SU is active SU, identify the inservice standby 
SU for this SU.
                         */
-
+                       AVD_SU_SI_REL *ot_susi;
                        ot_susi = avd_sg_npm_su_othr(cb, su);
 
                        if ((ot_susi != AVD_SU_SI_REL_NULL) &&
@@ -4061,8 +4056,6 @@ void SG_NPM::node_fail_si_oper(AVD_CL_CB
 }
 
 void SG_NPM::node_fail(AVD_CL_CB *cb, AVD_SU *su) {
-       AVD_SU *o_su;
-       AVD_SU_SI_REL *o_susi;
 
        TRACE_ENTER2("%u", su->sg_of_su->sg_fsm_state);
 
@@ -4106,6 +4099,7 @@ void SG_NPM::node_fail(AVD_CL_CB *cb, AV
                         */
 
                        su->delete_all_susis();
+                       AVD_SU *o_su;
                        if ((o_su = avd_sg_npm_su_chose_asgn(cb, su->sg_of_su)) 
!= nullptr) {
                                /* add the SU to the operation list and change 
the SG FSM to SG realign. */
                                avd_sg_su_oper_list_add(cb, o_su, false);
@@ -4133,7 +4127,7 @@ void SG_NPM::node_fail(AVD_CL_CB *cb, AV
        case AVD_SG_FSM_SG_ADMIN:
                if (su->list_of_susi->state == SA_AMF_HA_QUIESCING) {
                        /* The SU is quiescing.  */
-                       o_susi = avd_sg_npm_su_othr(cb, su);
+                       AVD_SU_SI_REL *o_susi = avd_sg_npm_su_othr(cb, su);
                        if (o_susi != AVD_SU_SI_REL_NULL) {
                                /* if the other SU w.r.t to SIs of this SU is 
not unassigning, 
                                 * send a D2N-INFO_SU_SI_ASSIGN with a remove 
all for that SU if it
@@ -4186,7 +4180,6 @@ void SG_NPM::node_fail(AVD_CL_CB *cb, AV
 }
 
 uint32_t SG_NPM::su_admin_down(AVD_CL_CB *cb, AVD_SU *su, AVD_AVND *avnd) {
-       uint32_t rc;
 
        TRACE_ENTER2("%u", su->sg_of_su->sg_fsm_state);
 
@@ -4197,7 +4190,7 @@ uint32_t SG_NPM::su_admin_down(AVD_CL_CB
        switch (su->sg_of_su->sg_fsm_state) {
        case AVD_SG_FSM_STABLE:
                if (su->list_of_susi->state == SA_AMF_HA_ACTIVE) {
-                       rc = NCSCC_RC_FAILURE;
+                       uint32_t rc = NCSCC_RC_FAILURE;
 
                        /* this is a active SU. */
                        if ((su->saAmfSUAdminState == SA_AMF_ADMIN_LOCKED) ||
diff --git a/src/amf/amfd/sg_nway_fsm.cc b/src/amf/amfd/sg_nway_fsm.cc
--- a/src/amf/amfd/sg_nway_fsm.cc
+++ b/src/amf/amfd/sg_nway_fsm.cc
@@ -144,8 +144,7 @@ uint32_t avd_sg_nway_siswitch_func(AVD_C
             curr_susi && (curr_susi->state != SA_AMF_HA_ACTIVE); curr_susi = 
curr_susi->si_next) ;
 
        if (!curr_susi) {
-               LOG_ER("%s:%u: %s (%zu)", __FILE__, __LINE__, 
curr_susi->su->name.c_str(), curr_susi->su->name.length());
-               LOG_ER("%s:%u: %s (%zu)", __FILE__, __LINE__, 
curr_susi->si->name.c_str(), curr_susi->si->name.length());
+               LOG_ER("No sisu active for '%s'", si->name.c_str());
                rc = NCSCC_RC_FAILURE;
                goto done;
        }
@@ -347,12 +346,11 @@ uint32_t SG_NWAY::susi_failed(AVD_CL_CB 
                                }
                        }
                        else if ((susi->state == SA_AMF_HA_ACTIVE) && (susi->su 
== sg->min_assigned_su)) {
-                               AVD_SU_SI_REL *t_susi = nullptr;
                                /* if the si is assigned active on min su in SI 
transfer */
                                /* delete the quiesced assignment on the max su 
 and let su failure
                                 * handling take care of assigning the standby 
to active */
                                /* find the susi with max assigned su which 
should be by now quiesced */
-                               t_susi = avd_su_susi_find(avd_cb, 
susi->si->sg_of_si->max_assigned_su, susi->si->name);
+                               AVD_SU_SI_REL *t_susi = 
avd_su_susi_find(avd_cb, susi->si->sg_of_si->max_assigned_su, susi->si->name);
                                osafassert(t_susi->state == SA_AMF_HA_QUIESCED);
 
                                if (avd_susi_del_send(t_susi) == 
NCSCC_RC_SUCCESS) {
@@ -637,8 +635,7 @@ uint32_t SG_NWAY::si_admin_down(AVD_CL_C
                             curr_susi && (curr_susi->state != 
SA_AMF_HA_ACTIVE); curr_susi = curr_susi->si_next) ;
 
                        if (!curr_susi) {
-                               LOG_ER("%s:%u: %s (%zu)", __FILE__, __LINE__, 
curr_susi->su->name.c_str(), curr_susi->su->name.length());
-                               LOG_ER("%s:%u: %s (%zu)", __FILE__, __LINE__, 
curr_susi->si->name.c_str(), curr_susi->si->name.length());
+                               LOG_ER("No sisu active for '%s'", 
si->name.c_str());
                                rc = NCSCC_RC_FAILURE;
                                goto done;
                        }
@@ -663,8 +660,7 @@ uint32_t SG_NWAY::si_admin_down(AVD_CL_C
                             curr_susi && (curr_susi->state != 
SA_AMF_HA_QUIESCING); curr_susi = curr_susi->si_next) ;
 
                        if (!curr_susi) {
-                               LOG_ER("%s:%u: %s (%zu)", __FILE__, __LINE__, 
curr_susi->su->name.c_str(), curr_susi->su->name.length());
-                               LOG_ER("%s:%u: %s (%zu)", __FILE__, __LINE__, 
curr_susi->si->name.c_str(), curr_susi->si->name.length());
+                               LOG_ER("No sisu active for '%s'", 
si->name.c_str());
                                rc = NCSCC_RC_FAILURE;
                                goto done;
                        }
@@ -788,8 +784,6 @@ done:
  */
 static void avd_sg_nway_swap_si_redistr(AVD_SG *sg)
 {
-       AVD_SU_SI_REL *susi = nullptr;
-
        osafassert(sg->si_tobe_redistributed != nullptr);
        osafassert(sg->max_assigned_su != nullptr);
        osafassert(sg->min_assigned_su != nullptr);
@@ -800,7 +794,7 @@ static void avd_sg_nway_swap_si_redistr(
        m_AVSV_SEND_CKPT_UPDT_ASYNC_ADD(avd_cb, sg, AVSV_CKPT_AVD_SI_TRANS);
 
        /* get the susi that is to be transferred */
-       susi = avd_su_susi_find(avd_cb, sg->max_assigned_su, 
sg->si_tobe_redistributed->name); 
+       AVD_SU_SI_REL *susi = avd_su_susi_find(avd_cb, sg->max_assigned_su, 
sg->si_tobe_redistributed->name); 
        osafassert(susi != nullptr);
 
 
@@ -1136,7 +1130,7 @@ AVD_SU *avd_sg_nway_get_su_std_equal(AVD
        }
        /* no more SIs can be assigned */
        if (l_flag == false)
-               curr_si = nullptr;
+               free(curr_si); 
 
        return pref_su;
 }
@@ -1252,9 +1246,8 @@ uint32_t avd_sg_nway_si_assign(AVD_CL_CB
                        /* The SI has sirankedsu configured and auto adjust 
enabled, make
                         *sure the highest ranked SU has the active assignment
                         */
-                       AVD_SU *preferred_su = nullptr;
                        AVD_SU *assigned_su = nullptr;
-                       preferred_su  = 
avd_sg_nway_si_find_highest_sirankedsu(cb, curr_si, &assigned_su);
+                       AVD_SU *preferred_su  = 
avd_sg_nway_si_find_highest_sirankedsu(cb, curr_si, &assigned_su);
                        if ((preferred_su && assigned_su) && preferred_su != 
assigned_su) {
                                TRACE("Move SI '%s' to su 
'%s'",curr_si->name.c_str(), preferred_su->name.c_str());
                                sg->si_tobe_redistributed = curr_si;
@@ -1281,9 +1274,8 @@ uint32_t avd_sg_nway_si_assign(AVD_CL_CB
 
                /* we've an unassigned si.. find su for active assignment */
                /* first, scan based on su rank for this si */
-               for (std::map<std::pair<std::string, uint32_t>, 
AVD_SUS_PER_SI_RANK*>::const_iterator
-                               it = sirankedsu_db->begin(); it != 
sirankedsu_db->end(); it++) {
-                       AVD_SUS_PER_SI_RANK *su_rank_rec = it->second;
+               for (const auto& value : *sirankedsu_db) {
+                       AVD_SUS_PER_SI_RANK *su_rank_rec = value.second;
                        {
                                if 
(su_rank_rec->indx.si_name.compare(curr_si->name) != 0) {
                                        continue;
@@ -1406,9 +1398,8 @@ uint32_t avd_sg_nway_si_assign(AVD_CL_CB
                /* we've a not-so-fully-assigned si.. find sus for standby 
assignment */
 
                /* first, scan based on su rank for this si */
-               for (std::map<std::pair<std::string, uint32_t>, 
AVD_SUS_PER_SI_RANK*>::const_iterator
-                               it = sirankedsu_db->begin(); it != 
sirankedsu_db->end(); it++) {
-                       AVD_SUS_PER_SI_RANK *su_rank_rec = it->second;
+               for (const auto& value : *sirankedsu_db) {
+                       AVD_SUS_PER_SI_RANK *su_rank_rec = value.second;
                        {
                                if 
(su_rank_rec->indx.si_name.compare(curr_si->name) != 0)
                                        continue;
@@ -2782,8 +2773,7 @@ uint32_t avd_sg_nway_susi_succ_si_oper(A
 
                        /* check if the min SU is still in-service */
                        if 
(susi->si->sg_of_si->min_assigned_su->saAmfSuReadinessState == 
SA_AMF_READINESS_IN_SERVICE) {
-                               AVD_SU_SI_REL *t_susi = nullptr;
-                               t_susi = avd_su_susi_find(avd_cb, 
susi->si->sg_of_si->min_assigned_su, susi->si->name);
+                               AVD_SU_SI_REL *t_susi = 
avd_su_susi_find(avd_cb, susi->si->sg_of_si->min_assigned_su, susi->si->name);
                                if (t_susi == nullptr) {
                                        /* initiate new active assignment for 
this SI */
                                        rc = avd_new_assgn_susi(avd_cb, 
susi->si->sg_of_si->min_assigned_su,
@@ -2861,7 +2851,6 @@ uint32_t avd_sg_nway_susi_succ_si_oper(A
                                LOG_ER("%s:%u: %s (%zu)", __FILE__, __LINE__, 
susi->si->name.c_str(), susi->si->name.length());
                        }
                } else if (susi->si->sg_of_si->si_tobe_redistributed == 
susi->si) { 
-                       AVD_SU_SI_REL *t_susi = nullptr;
                        /* si transfer is in progress for equal distribution 
                         * now get the susi between si tobe redistributed and 
max SU 
                         * should be quiesced state, now send a remove for that 
susi
@@ -2869,7 +2858,7 @@ uint32_t avd_sg_nway_susi_succ_si_oper(A
                        osafassert(susi->su == 
susi->si->sg_of_si->min_assigned_su);
 
                        /* find the susi with max assigned su which should be 
by now quiesced */
-                       t_susi = avd_su_susi_find(avd_cb, 
susi->si->sg_of_si->max_assigned_su, susi->si->name);
+                       AVD_SU_SI_REL *t_susi = avd_su_susi_find(avd_cb, 
susi->si->sg_of_si->max_assigned_su, susi->si->name);
                        osafassert(t_susi->state == SA_AMF_HA_QUIESCED);
 
                        rc = avd_susi_del_send(t_susi);
@@ -3476,7 +3465,6 @@ void avd_sg_nway_node_fail_sg_admin(AVD_
 void avd_sg_nway_node_fail_sg_realign(AVD_CL_CB *cb, AVD_SU *su)
 {
        SG_NWAY *sg = static_cast<SG_NWAY*>(su->sg_of_su);
-       bool is_su_present;
        AVD_AVND *su_node_ptr = nullptr;
 
        TRACE_ENTER2("SU '%s'",su->name.c_str());
@@ -3485,6 +3473,7 @@ void avd_sg_nway_node_fail_sg_realign(AV
                /* process as in si-oper state */
                sg->node_fail_si_oper(su);
        } else {
+               bool is_su_present;
                /* => si operation isnt in progress */
 
                /* check if su is present in the su-oper list */
diff --git a/src/amf/amfd/sg_nwayact_fsm.cc b/src/amf/amfd/sg_nwayact_fsm.cc
--- a/src/amf/amfd/sg_nwayact_fsm.cc
+++ b/src/amf/amfd/sg_nwayact_fsm.cc
@@ -88,9 +88,8 @@ AVD_SU *avd_sg_nacvred_su_chose_asgn(AVD
                /* identify a in-service SU which is not assigned to this SI 
and can
                 * take more assignments so that the SI can be assigned. 
                 */
-               for (std::map<std::pair<std::string, uint32_t>, 
AVD_SUS_PER_SI_RANK*>::const_iterator
-                               it = sirankedsu_db->begin(); it != 
sirankedsu_db->end(); it++) {
-                       AVD_SUS_PER_SI_RANK *su_rank_rec = it->second;
+               for (const auto& value : *sirankedsu_db) {
+                       AVD_SUS_PER_SI_RANK *su_rank_rec = value.second;
                        {
                                if 
(su_rank_rec->indx.si_name.compare(i_si->name) != 0)
                                        continue;
diff --git a/src/amf/amfd/sgproc.cc b/src/amf/amfd/sgproc.cc
--- a/src/amf/amfd/sgproc.cc
+++ b/src/amf/amfd/sgproc.cc
@@ -645,10 +645,9 @@ done:
 static void perform_cluster_reset_recovery() {
   TRACE_ENTER();
   uint32_t rc = NCSCC_RC_SUCCESS;
-  AVD_AVND *node = nullptr;
-  for (std::map<uint32_t, AVD_AVND *>::const_iterator it = node_id_db->begin();
-    it != node_id_db->end(); it++) {
-    node = it->second;
+  AVD_AVND *node;
+  for (const auto& value : *node_id_db) {
+         node = value.second;
     //First reboot payloads.
     if ((node->node_info.nodeId == avd_cb->node_id_avd) ||
                    (node->node_info.nodeId == avd_cb->node_id_avd_other))
@@ -660,7 +659,6 @@ static void perform_cluster_reset_recove
   }
 
   //Send for standby.
-  node = nullptr;
   node = avd_node_find_nodeid(avd_cb->node_id_avd_other);
   if (node != nullptr) {
     rc = avd_send_reboot_msg_directly(node);
@@ -669,7 +667,6 @@ static void perform_cluster_reset_recove
   }
 
   //Send for self.
-  node = nullptr;
   node = avd_node_find_nodeid(avd_cb->node_id_avd);
   osafassert(node != nullptr);
   rc = avd_send_reboot_msg_directly(node);
@@ -1497,9 +1494,8 @@ void avd_su_si_assign_evh(AVD_CL_CB *cb,
                                        /* Since a NCS SU has been assigned 
trigger the node FSM. */
                                        /* For (ncs_spec == SA_TRUE), su will 
not be external, so su
                                                   will have node attached. */
-                                       for (AmfDb<uint32_t, 
AVD_AVND>::const_iterator it = node_id_db->begin();
-                                               it != node_id_db->end(); it++) {
-                                               AVD_AVND *node = (*it).second;
+                                       for (const auto& value : *node_id_db) {
+                                               AVD_AVND *node = value.second;
 
                                                if (node->node_state == 
AVD_AVND_STATE_NCS_INIT && node->adest != 0) {
                                                        
avd_nd_ncs_su_assigned(cb, node);
@@ -1868,7 +1864,6 @@ uint32_t avd_sg_app_su_inst_func(AVD_CL_
 {
        uint32_t num_insvc_su = 0;
        uint32_t num_asgd_su = 0;
-       uint32_t num_su = 0;
        uint32_t num_try_insvc_su = 0;
        AVD_AVND *su_node_ptr = nullptr;
 
@@ -1884,7 +1879,6 @@ uint32_t avd_sg_app_su_inst_func(AVD_CL_
                TRACE("term_state: %u", i_su->term_state);
 
                su_node_ptr = i_su->get_node_ptr();
-               num_su++;
                /* Check if the SU is inservice */
                if (i_su->saAmfSuReadinessState == SA_AMF_READINESS_IN_SERVICE) 
{
                        num_insvc_su++;
diff --git a/src/amf/amfd/sgtype.cc b/src/amf/amfd/sgtype.cc
--- a/src/amf/amfd/sgtype.cc
+++ b/src/amf/amfd/sgtype.cc
@@ -83,7 +83,6 @@ static int is_config_valid(const std::st
        std::string::size_type pos;
        SaUint32T value;
        SaBoolT abool;
-       AVD_SUTYPE *sut;
        const SaImmAttrValuesT_2 *attr;
 
        if ((pos = dn.find(',')) == std::string::npos) {
@@ -115,7 +114,7 @@ static int is_config_valid(const std::st
 
        for (j = 0; j < attr->attrValuesNumber; j++) {
                SaNameT *name = (SaNameT *)attr->attrValues[j];
-               sut = sutype_db->find(Amf::to_string(name));
+               AVD_SUTYPE *sut = sutype_db->find(Amf::to_string(name));
                if (sut == nullptr) {
                        if (opdata == nullptr) {
                                report_ccb_validation_error(opdata, "'%s' does 
not exist in model", osaf_extended_name_borrow(name));
diff --git a/src/amf/amfd/si.cc b/src/amf/amfd/si.cc
--- a/src/amf/amfd/si.cc
+++ b/src/amf/amfd/si.cc
@@ -162,14 +162,13 @@ void AVD_SI::add_csi_db(AVD_CSI* csi)
 {
        TRACE_ENTER2("%s", csi->name.c_str());
 
-       AVD_CSI *i_csi = nullptr;
        AVD_CSI *prev_csi = nullptr;
        bool found_pos =  false;
 
        osafassert((csi != nullptr) && (csi->si != nullptr));
        osafassert(csi->si == this);
 
-       i_csi = list_of_csi;
+       AVD_CSI *i_csi = list_of_csi;
        while ((i_csi != nullptr) && (csi->rank <= i_csi->rank)) {
                while ((i_csi != nullptr) && (csi->rank == i_csi->rank)) {
                        if (compare_sanamet(csi->name, i_csi->name) < 0) {
@@ -246,14 +245,10 @@ void AVD_SI::remove_rankedsu(const std::
 
 void AVD_SI::remove_csi(AVD_CSI* csi)
 {
-       AVD_CSI *i_csi = nullptr;
+       osafassert(csi->si == this);
+       /* remove CSI from the SI */
        AVD_CSI *prev_csi = nullptr;
-       
-       osafassert(csi->si == this);
-
-       /* remove CSI from the SI */
-       prev_csi = nullptr;
-       i_csi = list_of_csi;
+       AVD_CSI *i_csi = list_of_csi;
 
        // find 'csi'
        while ((i_csi != nullptr) && (i_csi != csi)) {
@@ -322,11 +317,10 @@ AVD_SI *avd_si_new(const std::string& dn
  */
 void AVD_SI::delete_csis()
 {
-       AVD_CSI *csi, *temp;
+       AVD_CSI *csi = list_of_csi; 
 
-       csi = list_of_csi; 
        while (csi != nullptr) {
-               temp = csi;
+               AVD_CSI *temp = csi;
                csi = csi->si_list_of_csi_next;
                avd_csi_delete(temp);
        }
@@ -382,10 +376,9 @@ void AVD_SI::delete_assignments(AVD_CL_C
 void avd_si_db_add(AVD_SI *si)
 {
        TRACE_ENTER2("%s", si->name.c_str());
-       unsigned int rc;
 
        if (si_db->find(si->name) == nullptr) {
-               rc = si_db->insert(si->name, si);
+                unsigned int rc = si_db->insert(si->name, si);
                osafassert(rc == NCSCC_RC_SUCCESS);
        }
        TRACE_LEAVE();
@@ -1107,7 +1100,6 @@ void AVD_SI::adjust_si_assignments(const
                                LOG_ER("SI new assignmemts failed  SI:%s", 
name.c_str());
                        } 
                } else {
-                       no_of_sisus_to_delete = 0;
                        no_of_sisus_to_delete = 
saAmfSINumCurrStandbyAssignments -
                                                mod_pref_assignments; 
 
@@ -1487,7 +1479,7 @@ bool AVD_SI::is_sirank_valid(uint32_t ne
        std::list<AVD_SI*> depsi_list;
        get_dependent_si_list(name, depsi_list);
        for (std::list<AVD_SI*>::const_iterator it = depsi_list.begin();
-                       it != depsi_list.end(); it++) {
+                       it != depsi_list.end(); ++it) {
                if (newSiRank > (*it)->saAmfSIRank) {
                        LOG_ER("Invalid saAmfSIRank, ('%s', rank: %u) is lower 
rank than "
                                        "dependent si ('%s', rank: %u)", 
name.c_str(), newSiRank, 
diff --git a/src/amf/amfd/si_dep.cc b/src/amf/amfd/si_dep.cc
--- a/src/amf/amfd/si_dep.cc
+++ b/src/amf/amfd/si_dep.cc
@@ -298,20 +298,18 @@ bool sidep_is_si_active(AVD_SI *si)
  **************************************************************************/
 void sidep_spons_list_del(AVD_SI_DEP *si_dep_rec)
 {
-       AVD_SI *dep_si = nullptr;
-       AVD_SPONS_SI_NODE *spons_si_node = nullptr;
        AVD_SPONS_SI_NODE *del_spons_si_node = nullptr;
 
        TRACE_ENTER();
 
        /* Dependent SI should be active, if not return error */
-       dep_si = avd_si_get(si_dep_rec->dep_name);
+       AVD_SI *dep_si = avd_si_get(si_dep_rec->dep_name);
        osafassert(dep_si != nullptr); 
 
        /* SI doesn't depend on any other SIs */
        osafassert (dep_si->spons_si_list != nullptr);
 
-       spons_si_node = dep_si->spons_si_list;
+       AVD_SPONS_SI_NODE *spons_si_node = dep_si->spons_si_list;
 
        /* Check if the sponsor is the first node of the list */
        if (dep_si->spons_si_list->si->name.compare(si_dep_rec->spons_si->name) 
== 0) {
@@ -439,12 +437,11 @@ void sidep_stop_tol_timer(AVD_CL_CB *cb,
  **************************************************************************/
 uint32_t sidep_unassign_dependent(AVD_CL_CB *cb, AVD_SI *si)
 {
-       AVD_SU_SI_REL *susi = nullptr;
        uint32_t rc = NCSCC_RC_FAILURE;
 
        TRACE_ENTER2("'%s'", si->name.c_str());
 
-       susi = si->list_of_sisu;
+       AVD_SU_SI_REL *susi = si->list_of_sisu;
        while (susi != AVD_SU_SI_REL_NULL && susi->fsm != 
AVD_SU_SI_STATE_UNASGN) {
                if ((rc = avd_susi_del_send(susi)) != NCSCC_RC_SUCCESS)
                        goto done;
@@ -529,12 +526,11 @@ done:
  
*****************************************************************************************/
 uint32_t sidep_si_dep_state_evt_send(AVD_CL_CB *cb, AVD_SI *si, AVD_EVT_TYPE 
evt_type)
 {
-       AVD_EVT *evt = nullptr;
        uint32_t rc = NCSCC_RC_FAILURE;
 
        TRACE_ENTER2("si:'%s' evt_type:%u", si->name.c_str(), evt_type);
 
-       evt = new AVD_EVT();
+       AVD_EVT *evt = new AVD_EVT();
 
        /*Update evt struct, using tmr field even though this field is not
         * relevant for this event, but it accommodates the required data.
@@ -595,15 +591,12 @@ void avd_sidep_stdby_amfd_tol_timer_expi
 */
 void avd_sidep_tol_tmr_evh(AVD_CL_CB *cb, AVD_EVT *evt)
 {
-       AVD_SI *si = nullptr;
-       AVD_SI *spons_si = nullptr;
-
        TRACE_ENTER();
 
        osafassert(evt->info.tmr.type == AVD_TMR_SI_DEP_TOL);
 
-       si = avd_si_get(evt->info.tmr.dep_si_name);
-       spons_si = avd_si_get(evt->info.tmr.spons_si_name);
+       AVD_SI *si = avd_si_get(evt->info.tmr.dep_si_name);
+       AVD_SI *spons_si = avd_si_get(evt->info.tmr.spons_si_name);
 
        if ((si == nullptr) || (spons_si == nullptr)) {
                /* Nothing to do here as SI/spons-SI itself lost their 
existence */
@@ -853,11 +846,8 @@ done:
  **************************************************************************/
 void sidep_si_dep_start_unassign(AVD_CL_CB *cb, AVD_EVT *evt)
 {
-       AVD_SI *si = nullptr;
-
        TRACE_ENTER();
-
-       si = avd_si_get(evt->info.tmr.dep_si_name);
+       AVD_SI *si = avd_si_get(evt->info.tmr.dep_si_name);
 
        if (!si) {
                LOG_ER("Received si nullptr");
@@ -912,11 +902,9 @@ done:
  **************************************************************************/
 void sidep_update_si_dep_state_for_spons_unassign(AVD_CL_CB *cb, AVD_SI 
*dep_si, AVD_SI_DEP *si_dep_rec)
 {
-       AVD_SI *spons_si = nullptr;
-
        TRACE_ENTER2("si:'%s', 
si_dep_state:'%s'",dep_si->name.c_str(),depstatename[dep_si->si_dep_state]);
 
-       spons_si = avd_si_get(si_dep_rec->spons_name);
+        AVD_SI *spons_si = avd_si_get(si_dep_rec->spons_name);
        osafassert(spons_si != nullptr);
 
        /* Take action only when both sponsor and dependent belongs to same sg 
@@ -974,9 +962,8 @@ void sidep_take_action_on_dependents(AVD
 {
        TRACE_ENTER();
 
-       for (std::map<std::pair<std::string,std::string>, 
AVD_SI_DEP*>::const_iterator it = sidep_db->begin();
-                       it != sidep_db->end(); it++) {
-               const AVD_SI_DEP *sidep = it->second;
+       for (const auto& value : *sidep_db) {
+               const AVD_SI_DEP *sidep = value.second;
 
                if (sidep->spons_si != si)
                        continue;
@@ -1019,9 +1006,8 @@ void sidep_take_action_on_dependents(AVD
 
 AVD_SI_DEP *get_sidep_with_same_dep(AVD_SI_DEP *sidep) 
 {
-       for (std::map<std::pair<std::string,std::string>, 
AVD_SI_DEP*>::const_iterator it = sidep_db->begin();
-                       it != sidep_db->end(); it++) {
-               AVD_SI_DEP *tmp_sidep = it->second;
+       for (const auto& value : *sidep_db) {
+               AVD_SI_DEP *tmp_sidep = value.second;
                if (sidep == tmp_sidep)
                        continue;
                if (tmp_sidep->dep_name.compare(sidep->dep_name) == 0)
@@ -1071,9 +1057,8 @@ uint32_t sidep_cyclic_dep_find(AVD_SI_DE
        
 
        while (last) {
-               for (std::map<std::pair<std::string,std::string>, 
AVD_SI_DEP*>::const_iterator it = sidep_db->begin();
-                               it != sidep_db->end(); it++) {
-                       tmp_sidep = it->second;
+               for (const auto& value : *sidep_db) {
+                       tmp_sidep = value.second;
                        if (tmp_sidep->dep_name.compare(last->si_name) == 0)
                                break;
                }
@@ -1466,9 +1451,8 @@ void avd_sidep_unassign_dependents(AVD_S
 
        TRACE_ENTER2(": '%s'",si->name.c_str());
 
-       for (std::map<std::pair<std::string,std::string>, 
AVD_SI_DEP*>::const_iterator it = sidep_db->begin();
-                       it != sidep_db->end(); it++) {
-               const AVD_SI_DEP *sidep = it->second;
+       for (const auto& value : *sidep_db) {
+               const AVD_SI_DEP *sidep = value.second;
                if (sidep->spons_si->name.compare(si->name) != 0)
                        continue;
 
@@ -1614,7 +1598,6 @@ bool avd_sidep_is_si_failover_possible(A
                 * 2) None of its sponsors SI is undergoing admin lock operation
                 */
                for (spons_si_node = 
si->spons_si_list;spons_si_node;spons_si_node = spons_si_node->next) {
-                       assignmemt_status = false;
                        active_sisu = nullptr;
                        valid_stdby_sisu = nullptr;
 
@@ -1795,9 +1778,8 @@ void avd_sidep_update_depstate_si_failov
 
        TRACE_ENTER2("si:%s",si->name.c_str());
 
-       for (std::map<std::pair<std::string,std::string>, 
AVD_SI_DEP*>::const_iterator it = sidep_db->begin();
-                       it != sidep_db->end(); it++) {
-               const AVD_SI_DEP *sidep = it->second;
+       for (const auto& value : *sidep_db) {
+               const AVD_SI_DEP *sidep = value.second;
                if (sidep->spons_si->name.compare(si->name) != 0) 
                        continue;
 
@@ -2054,9 +2036,8 @@ void avd_sidep_reset_dependents_depstate
 {
        TRACE_ENTER2(" SI: '%s'",si->name.c_str());
 
-       for (std::map<std::pair<std::string,std::string>, 
AVD_SI_DEP*>::const_iterator it = sidep_db->begin();
-                       it != sidep_db->end(); it++) {
-               const AVD_SI_DEP *sidep = it->second;
+       for (const auto& value : *sidep_db) {
+               const AVD_SI_DEP *sidep = value.second;
 
                if (sidep->spons_si->name.compare(si->name) != 0) 
                        continue;
@@ -2126,9 +2107,8 @@ void avd_sidep_send_active_to_dependents
                }       
        }   
 
-       for (std::map<std::pair<std::string,std::string>, 
AVD_SI_DEP*>::const_iterator it = sidep_db->begin();
-                       it != sidep_db->end(); it++) {
-               const AVD_SI_DEP *sidep = it->second;
+       for (const auto& value : *sidep_db) {
+               const AVD_SI_DEP *sidep = value.second;
                if (sidep->spons_si->name.compare(si->name) != 0) 
                        continue;
 
@@ -2190,9 +2170,8 @@ bool avd_sidep_quiesced_done_for_all_dep
 
        TRACE_ENTER2(": '%s'",si->name.c_str());
 
-       for (std::map<std::pair<std::string,std::string>, 
AVD_SI_DEP*>::const_iterator it = sidep_db->begin();
-                       it != sidep_db->end(); it++) {
-               const AVD_SI_DEP *sidep = it->second;
+       for (const auto& value : *sidep_db) {
+               const AVD_SI_DEP *sidep = value.second;
                if (sidep->spons_si->name.compare(si->name) != 0) 
                        continue;
 
@@ -2266,9 +2245,8 @@ void sidep_update_dependents_states(AVD_
         */
        TRACE("sponsor si:'%s', dep state:'%s'", si->name.c_str(), 
depstatename[si->si_dep_state]);
 
-       for (std::map<std::pair<std::string,std::string>, 
AVD_SI_DEP*>::const_iterator it = sidep_db->begin();
-                       it != sidep_db->end(); it++) {
-               const AVD_SI_DEP *sidep = it->second;
+       for (const auto& value : *sidep_db) {
+               const AVD_SI_DEP *sidep = value.second;
                if (sidep->spons_si->name.compare(si->name) != 0) 
                        continue;
 
@@ -2520,9 +2498,8 @@ done:
  */
 void get_dependent_si_list(const std::string& spons_si_name, 
std::list<AVD_SI*>& depsi_list)
 {
-       std::map<std::pair<std::string,std::string>, 
AVD_SI_DEP*>::const_iterator it;
-       for (it = sidep_db->begin(); it != sidep_db->end(); it++) {
-               const AVD_SI_DEP *sidep = it->second;
+       for (const auto& value : *sidep_db) {
+               const AVD_SI_DEP *sidep = value.second;
                if (sidep->spons_si->name.compare(spons_si_name) != 0)
                        continue;
                depsi_list.push_back(sidep->dep_si);
diff --git a/src/amf/amfd/siass.cc b/src/amf/amfd/siass.cc
--- a/src/amf/amfd/siass.cc
+++ b/src/amf/amfd/siass.cc
@@ -448,9 +448,8 @@ AVD_SU_SI_REL *avd_susi_create(AVD_CL_CB
         */
 
        /* determine if the su is ranked per si */
-       for (std::map<std::pair<std::string, uint32_t>, 
AVD_SUS_PER_SI_RANK*>::const_iterator
-                       it = sirankedsu_db->begin(); it != 
sirankedsu_db->end(); it++) {
-               su_rank_rec = it->second;
+       for (const auto& value : *sirankedsu_db) {
+               su_rank_rec = value.second;
                if (su_rank_rec->indx.si_name.compare(si->name) != 0)
                        continue;
                curr_su = su_db->find(su_rank_rec->su_name);
@@ -469,9 +468,8 @@ AVD_SU_SI_REL *avd_susi_create(AVD_CL_CB
                                continue;
 
                        /* determine the su_rank rec for this rec */
-                       for (std::map<std::pair<std::string, uint32_t>, 
AVD_SUS_PER_SI_RANK*>::const_iterator
-                                       it = sirankedsu_db->begin(); it != 
sirankedsu_db->end(); it++) {
-                               i_su_rank_rec = it->second;
+                       for (const auto& value : *sirankedsu_db) {
+                               i_su_rank_rec = value.second;
                                if 
(i_su_rank_rec->indx.si_name.compare(si->name) != 0)
                                        continue;
                                curr_su = su_db->find(i_su_rank_rec->su_name);
@@ -1038,9 +1036,8 @@ bool avd_susi_quiesced_canbe_given(const
                return quiesc_role;
        } else {
                /* Check if any of its dependents assigned to same SU for which 
quiesced role is not yet given */
-               for (std::map<std::pair<std::string,std::string>, 
AVD_SI_DEP*>::const_iterator it = sidep_db->begin();
-                       it != sidep_db->end(); it++) {
-                       const AVD_SI_DEP *sidep = it->second;
+               for (const auto& value : *sidep_db) {
+                       const AVD_SI_DEP *sidep = value.second;
                        if (sidep->spons_si->name.compare(susi->si->name) != 0) 
                                continue;
 
@@ -1074,12 +1071,11 @@ SaAisErrorT avd_susi_recreate(AVSV_N2D_N
        TRACE_ENTER2("msg_id: %u node_id: %u num_sisu: %u", info->msg_id,
                info->node_id, info->num_sisu);
        AVD_SU_SI_REL *susi = nullptr;
-       AVD_AVND *node = nullptr;
 
        const AVSV_SISU_STATE_MSG *susi_state = nullptr;
        const AVSV_SU_STATE_MSG *su_state = nullptr;
 
-       node = avd_node_find_nodeid(info->node_id);
+       AVD_AVND *node = avd_node_find_nodeid(info->node_id);
        if (node == 0) {
           LOG_ER("Node %" PRIx32 " has left the cluster", info->node_id);
           return SA_AIS_ERR_NOT_EXIST;
diff --git a/src/amf/amfd/sirankedsu.cc b/src/amf/amfd/sirankedsu.cc
--- a/src/amf/amfd/sirankedsu.cc
+++ b/src/amf/amfd/sirankedsu.cc
@@ -42,13 +42,12 @@ static void avd_susi_namet_init(const st
 
 static void avd_sirankedsu_db_add(AVD_SUS_PER_SI_RANK *sirankedsu)
 {
-       AVD_SI *avd_si = nullptr;
        unsigned int rc = 
sirankedsu_db->insert(make_pair(sirankedsu->indx.si_name,
                sirankedsu->indx.su_rank), sirankedsu);
        osafassert(rc == NCSCC_RC_SUCCESS);
 
        /* Find the si name. */
-       avd_si = avd_si_get(sirankedsu->indx.si_name);
+       AVD_SI *avd_si = avd_si_get(sirankedsu->indx.si_name);
        avd_si->add_rankedsu(sirankedsu->su_name, sirankedsu->indx.su_rank);
 
        /* Add sus_per_si_rank to si */
@@ -104,13 +103,12 @@ static AVD_SUS_PER_SI_RANK *avd_siranked
 
 static AVD_SUS_PER_SI_RANK *avd_sirankedsu_find(AVD_CL_CB *cb, const 
AVD_SUS_PER_SI_RANK_INDX &indx)
 {
-       AVD_SUS_PER_SI_RANK *ranked_su_per_si = nullptr;
        AVD_SUS_PER_SI_RANK_INDX rank_indx;
 
        rank_indx.si_name = indx.si_name;
        rank_indx.su_rank = indx.su_rank;
 
-       ranked_su_per_si = sirankedsu_db->find(make_pair(rank_indx.si_name,
+       AVD_SUS_PER_SI_RANK *ranked_su_per_si = 
sirankedsu_db->find(make_pair(rank_indx.si_name,
                                rank_indx.su_rank));
 
        return ranked_su_per_si;
@@ -160,7 +158,6 @@ static AVD_SUS_PER_SI_RANK * avd_siranke
                const SaImmAttrValuesT_2 **attributes)
 {
         uint32_t rank = 0;
-       AVD_SUS_PER_SI_RANK *avd_sus_per_si_rank = nullptr;
        std::string su_name;
        std::string si_name;
        AVD_SUS_PER_SI_RANK_INDX indx;
@@ -173,7 +170,7 @@ static AVD_SUS_PER_SI_RANK * avd_siranke
        indx.si_name = si_name;
        indx.su_rank = rank;
 
-       avd_sus_per_si_rank = avd_sirankedsu_create(avd_cb, indx);
+       AVD_SUS_PER_SI_RANK *avd_sus_per_si_rank = 
avd_sirankedsu_create(avd_cb, indx);
        osafassert(avd_sus_per_si_rank);
 
        avd_sus_per_si_rank->su_name = su_name;
@@ -232,7 +229,6 @@ static void avd_sirankedsu_del_si_list(A
 
 static int is_config_valid(const std::string& dn, const SaImmAttrValuesT_2 
**attributes, CcbUtilOperationData_t *opdata)
 {
-        AVD_SI *avd_si = nullptr;
        std::string su_name;
        std::string si_name;
         uint32_t rank = 0;
@@ -242,7 +238,7 @@ static int is_config_valid(const std::st
         avd_susi_namet_init(dn, su_name, si_name);
 
         /* Find the si name. */
-        avd_si = avd_si_get(si_name);
+        AVD_SI *avd_si = avd_si_get(si_name);
 
         if (avd_si == nullptr) {
                 /* SI does not exist in current model, check CCB */
@@ -350,9 +346,8 @@ static int avd_sirankedsu_ccb_complete_d
        avd_susi_namet_init(Amf::to_string(opdata->param.delete_.objectName), 
su_name, si_name);
 
        /* determine if the su is ranked per si */
-       for (std::map<std::pair<std::string, uint32_t>, 
AVD_SUS_PER_SI_RANK*>::const_iterator
-                       it = sirankedsu_db->begin(); it != 
sirankedsu_db->end(); it++) {
-               su_rank_rec = it->second;
+       for (const auto& value : *sirankedsu_db) {
+               su_rank_rec = value.second;
 
                if (su_rank_rec->indx.si_name.compare(si_name) == 0 &&
                        su_rank_rec->su_name.compare(su_name) == 0) {
diff --git a/src/amf/amfd/su.cc b/src/amf/amfd/su.cc
--- a/src/amf/amfd/su.cc
+++ b/src/amf/amfd/su.cc
@@ -515,7 +515,7 @@ static AVD_AVND *map_su_to_node(AVD_SU *
        /* Find a node in the group that doesn't have a SU in same SG mapped to 
it already */
        for (node_iter = ng->saAmfNGNodeList.begin();
                node_iter != ng->saAmfNGNodeList.end();
-               node_iter++) {
+               ++node_iter) {
 
                node = avd_node_get(*node_iter);
                osafassert(node);
@@ -1943,10 +1943,8 @@ void su_ccb_apply_delete_hdlr(struct Ccb
 
                        //Create a tmp database of compcstype.
                        std::set<std::string> compcstype_list;
-                       for (std::map<std::string, 
AVD_COMPCS_TYPE*>::const_iterator it =
-                                       compcstype_db->begin();
-                                       it != compcstype_db->end(); it++) {
-                               AVD_COMPCS_TYPE *compcstype = it->second;
+                       for (const auto& value : *compcstype_db) {
+                               AVD_COMPCS_TYPE *compcstype = value.second;
                                compcstype_list.insert(compcstype->name);
                        }
                        TRACE("Standby Amfd, comp '%s' not deleted", 
osaf_extended_name_borrow(&comp->comp_info.name));
diff --git a/src/amf/amfd/sutype.cc b/src/amf/amfd/sutype.cc
--- a/src/amf/amfd/sutype.cc
+++ b/src/amf/amfd/sutype.cc
@@ -61,7 +61,6 @@ static AVD_SUTYPE *sutype_create(const s
 {
        const SaImmAttrValuesT_2 *attr;
        AVD_SUTYPE *sutype;
-       int rc = 0;
        unsigned i = 0;
        SaAisErrorT error;
 
@@ -98,11 +97,6 @@ static AVD_SUTYPE *sutype_create(const s
                TRACE("%s", sutype->saAmfSutProvidesSvcTypes.back().c_str());
        }
 
-       rc = 0;
-
-       if (rc != 0)
-               sutype_delete(&sutype);
-
        TRACE_LEAVE();
 
        return sutype;
diff --git a/src/amf/amfd/util.cc b/src/amf/amfd/util.cc
--- a/src/amf/amfd/util.cc
+++ b/src/amf/amfd/util.cc
@@ -529,16 +529,15 @@ uint32_t avd_snd_su_reg_msg(AVD_CL_CB *c
        if (avnd->node_info.nodeId == cb->node_id_avd) {
                // filter out external SUs from all SUs
                std::vector<AVD_SU*> ext_su_vec;
-               for (std::map<std::string, AVD_SU*>::const_iterator it = 
su_db->begin();
-                               it != su_db->end(); it++) {
-                       su = it->second;
+               for (const auto& value : *su_db) {
+                       su = value.second;
                        if (su->su_is_external == true)
                                ext_su_vec.push_back(su);
                }
 
                // And add them
                for (std::vector<AVD_SU*>::iterator it = ext_su_vec.begin();
-                               it != ext_su_vec.end(); it++) {
+                               it != ext_su_vec.end(); ++it) {
                        su = *it;
                        reg_su_msg_init_su_info(su_msg, su);
                }
@@ -1029,7 +1028,6 @@ uint32_t avd_snd_susi_msg(AVD_CL_CB *cb,
 static uint32_t avd_prep_pg_mem_list(AVD_CL_CB *cb, AVD_CSI *csi, 
SaAmfProtectionGroupNotificationBufferT *mem_list)
 {
        AVD_COMP_CSI_REL *curr = 0;
-       uint32_t i = 0;
 
        TRACE_ENTER();
 
@@ -1038,7 +1036,7 @@ static uint32_t avd_prep_pg_mem_list(AVD
        if (csi->compcsi_cnt) {
                /* alloc the memory for the notify buffer */
                mem_list->notification = new 
SaAmfProtectionGroupNotificationT[csi->compcsi_cnt]();
-
+               uint32_t i = 0;
                /* copy the contents */
                for (curr = csi->list_compcsi; curr; curr = 
curr->csi_csicomp_next, i++) {
                        SaNameT comp_name;
@@ -1269,13 +1267,12 @@ uint32_t avd_snd_set_leds_msg(AVD_CL_CB 
 
 uint32_t avd_snd_comp_validation_resp(AVD_CL_CB *cb, AVD_AVND *avnd, AVD_COMP 
*comp_ptr, AVD_DND_MSG *n2d_msg)
 {
-       AVD_DND_MSG *d2n_msg = nullptr;
        AVD_AVND *su_node_ptr = nullptr;
 
        TRACE_ENTER();
 
        /* prepare the component validation message. */
-       d2n_msg = new AVSV_DND_MSG();
+       AVD_DND_MSG *d2n_msg = new AVSV_DND_MSG();
 
        /* prepare the componenet validation response message */
        d2n_msg->msg_type = AVSV_D2N_COMP_VALIDATION_RESP_MSG;
@@ -1388,9 +1385,8 @@ int amfd_file_dump(const char *filename)
 
 
        fprintf(f, "nodes:\n");
-       for (std::map<uint32_t, AVD_AVND *>::const_iterator it = 
node_id_db->begin();
-                       it != node_id_db->end(); it++) {
-               AVD_AVND *node = it->second;
+       for (const auto& value : *node_id_db) {
+               AVD_AVND *node = value.second;
                fprintf(f, "  dn: %s\n", node->name.c_str());
                fprintf(f, "    saAmfNodeAdminState: %s\n",
                                avd_adm_state_name[node->saAmfNodeAdminState]);
@@ -1404,9 +1400,8 @@ int amfd_file_dump(const char *filename)
        }
 
        fprintf(f, "applications:\n");
-       for (std::map<std::string, AVD_APP*>::const_iterator it = 
app_db->begin();
-                       it != app_db->end(); it++) {
-               const AVD_APP *app = it->second;
+       for (const auto& value : *app_db) {
+               const AVD_APP *app = value.second;
                fprintf(f, "  dn: %s\n", app->name.c_str());
                fprintf(f, "    saAmfApplicationAdminState: %s\n",
                                
avd_adm_state_name[app->saAmfApplicationAdminState]);
@@ -1415,9 +1410,8 @@ int amfd_file_dump(const char *filename)
        }
 
        fprintf(f, "service_instances:\n");
-       for (std::map<std::string, AVD_SI*>::const_iterator it = si_db->begin();
-                       it != si_db->end(); it++) {
-               si = it->second;
+       for (const auto& value : *si_db) {
+               si = value.second;
                fprintf(f, "  dn: %s\n", si->name.c_str());
                fprintf(f, "    saAmfSIProtectedbySG: %s\n",
                                si->saAmfSIProtectedbySG.c_str());
@@ -1442,9 +1436,8 @@ int amfd_file_dump(const char *filename)
        }
 
        fprintf(f, "component_service_instances:\n");
-       for (std::map<std::string, AVD_CSI*>::const_iterator it = 
csi_db->begin();
-                       it != csi_db->end(); it++) {
-               csi = it->second;
+       for (const auto& value : *csi_db) {
+               csi = value.second;
                fprintf(f, "  dn: %s\n", csi->name.c_str());
                fprintf(f, "    rank: %u\n", csi->rank);
                fprintf(f, "    depends:\n");
@@ -1461,9 +1454,8 @@ int amfd_file_dump(const char *filename)
        }
 
        fprintf(f, "service_groups:\n");
-       for (std::map<std::string, AVD_SG*>::const_iterator it = sg_db->begin();
-                       it != sg_db->end(); it++) {
-               const AVD_SG *sg = it->second;
+       for (const auto& value : *sg_db) {
+               const AVD_SG *sg = value.second;
                fprintf(f, "  dn: %s\n", sg->name.c_str());
                fprintf(f, "    saAmfSGAdminState: %s\n",
                                avd_adm_state_name[sg->saAmfSGAdminState]);
@@ -1478,9 +1470,8 @@ int amfd_file_dump(const char *filename)
        }
 
        fprintf(f, "service_units:\n");
-       for (std::map<std::string, AVD_SU*>::const_iterator it = su_db->begin();
-                       it != su_db->end(); it++) {
-               const AVD_SU *su = it->second;
+       for (const auto& value : *su_db) {
+               const AVD_SU *su = value.second;
                fprintf(f, "  dn: %s\n", su->name.c_str());
                fprintf(f, "    saAmfSUPreInstantiable: %u\n", 
su->saAmfSUPreInstantiable);
                fprintf(f, "    saAmfSUOperState: %s\n",
@@ -1506,9 +1497,8 @@ int amfd_file_dump(const char *filename)
        }
 
        fprintf(f, "components:\n");
-       for (std::map<std::string, AVD_COMP*>::const_iterator it = 
comp_db->begin();
-                       it != comp_db->end(); it++) {
-               const AVD_COMP *comp  = it->second;
+       for (const auto& value : *comp_db) {
+               const AVD_COMP *comp  = value.second;
                fprintf(f, "  dn: %s\n", 
osaf_extended_name_borrow(&comp->comp_info.name));
                fprintf(f, "    saAmfCompOperState: %s\n",
                                avd_oper_state_name[comp->saAmfCompOperState]);
@@ -1522,9 +1512,8 @@ int amfd_file_dump(const char *filename)
        }
 
         fprintf(f, "COMPCS_TYPE:\n");
-        for (std::map<std::string, AVD_COMPCS_TYPE*>::const_iterator it = 
compcstype_db->begin();
-                        it != compcstype_db->end(); it++) {
-                const AVD_COMPCS_TYPE *compcs_type  = it->second;
+       for (const auto& value : *compcstype_db) {
+               const AVD_COMPCS_TYPE *compcs_type  = value.second;
                 fprintf(f, "  dn: %s\n", compcs_type->name.c_str());
                 fprintf(f, "    saAmfCompNumMaxActiveCSIs: %u\n",
                                 compcs_type->saAmfCompNumMaxActiveCSIs);
@@ -1538,9 +1527,8 @@ int amfd_file_dump(const char *filename)
 
 
        fprintf(f, "Node Groups:\n");
-       for (std::map<std::string, AVD_AMF_NG*>::const_iterator it = 
nodegroup_db->begin();
-                        it != nodegroup_db->end(); it++) {
-               AVD_AMF_NG *ng = it->second;
+       for (const auto& value : *nodegroup_db) {
+               AVD_AMF_NG *ng = value.second;
                fprintf(f, "  dn: %s\n", ng->name.c_str());
                fprintf(f, "    saAmfNGAdminState: 
%s\n",avd_adm_state_name[ng->saAmfNGAdminState]);
        }
@@ -1563,7 +1551,6 @@ int avd_admin_op_msg_snd(const std::stri
 {
        AVD_CL_CB *cb = (AVD_CL_CB *)avd_cb;
        AVD_DND_MSG *d2n_msg;
-       unsigned int rc = NCSCC_RC_SUCCESS;
 
        SaNameT temp_dn;
        osaf_extended_name_alloc(dn.c_str(), &temp_dn);
@@ -1578,7 +1565,7 @@ int avd_admin_op_msg_snd(const std::stri
        d2n_msg->msg_info.d2n_admin_op_req_info.class_id = class_id;
        d2n_msg->msg_info.d2n_admin_op_req_info.oper_id = opId;
 
-       rc = avd_d2n_msg_snd(cb, node, d2n_msg);
+       unsigned int rc = avd_d2n_msg_snd(cb, node, d2n_msg);
        if (rc != NCSCC_RC_SUCCESS) {
                LOG_ER("%s: snd to %x failed", __FUNCTION__, 
node->node_info.nodeId);
                d2n_msg_free(d2n_msg);
@@ -2009,16 +1996,13 @@ uint32_t avd_snd_compcsi_msg(AVD_COMP *c
   AVSV_CSI_ATTRS *ptr_csiattr_msg = nullptr;
   AVSV_ATTR_NAME_VAL *i_ptr_msg = nullptr;
   AVD_CSI_ATTR *attr_ptr_db = nullptr;
-  AVD_AVND *avnd = nullptr;
 
   TRACE_ENTER2("'%s', '%s', act:%u",
     osaf_extended_name_borrow(&compcsi->comp->comp_info.name),
     csi->name.c_str(), act);
 
-  //Depending upon the message sub type retrieve node from eligible entity.
-  if (act == AVSV_COMPCSI_ATTR_CHANGE_AND_NO_ACK) {
-    avnd = comp->su->get_node_ptr();
-  }
+  AVD_AVND *avnd = comp->su->get_node_ptr();
+  
   if ((avnd->node_state == AVD_AVND_STATE_ABSENT) ||
     (avnd->node_state == AVD_AVND_STATE_GO_DOWN)) {
     TRACE_LEAVE();
@@ -2075,7 +2059,6 @@ uint32_t avd_snd_compcsi_msg(AVD_COMP *c
       d2n_msg_free(compcsi_msg);
       TRACE_LEAVE();
       return NCSCC_RC_FAILURE;
-      break;
     }
   }
 

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to