Hi Mahesh, Reviewed and tested the patch. The patch silently fix IMMA UP bug.
Ack from me. Thanks, Zoran -----Original Message----- From: [email protected] [mailto:[email protected]] Sent: den 3 mars 2017 06:42 To: Zoran Milinkovic <[email protected]>; Hung Duc Nguyen <[email protected]>; [email protected] Cc: [email protected] Subject: [PATCH 1 of 1] imm: Fix all Cppcheck 1.77 issues [#2333] src/imm/agent/imma_db.cc | 8 +--- src/imm/agent/imma_mds.cc | 6 +-- src/imm/agent/imma_oi_api.cc | 3 +- src/imm/agent/imma_om_api.cc | 19 +++++---- src/imm/agent/imma_proc.cc | 12 ++---- src/imm/immd/immd_db.c | 9 +--- src/imm/immd/immd_evt.c | 29 ++++++--------- src/imm/immd/immd_mbcsv.c | 9 +--- src/imm/immd/immd_mds.c | 17 ++------ src/imm/immnd/ImmModel.cc | 80 ++++++++++++++++++++----------------------- src/imm/immnd/immnd_clm.c | 4 +- src/imm/immnd/immnd_db.c | 7 +-- src/imm/immnd/immnd_evt.c | 29 +++++---------- src/imm/immnd/immnd_main.c | 4 +- src/imm/immnd/immnd_mds.c | 10 +--- src/imm/immnd/immnd_proc.c | 7 +-- 16 files changed, 98 insertions(+), 155 deletions(-) Except never used functions all other issues are fixed of below, some UN-pushed enhancement may be using those functions. [staging/src/imm/immnd/ImmModel.cc:2985] -> [staging/src/imm/immnd/ImmModel.cc:3002]: (warning) Either the condition 'increment&&immObject' is redundant or there is possible null pointer dereference: immObject. [staging/src/imm/immnd/ImmModel.cc:2986] -> [staging/src/imm/immnd/ImmModel.cc:3002]: (warning) Either the condition 'increment&&immObject' is redundant or there is possible null pointer dereference: immObject. [staging/src/imm/immnd/ImmModel.cc:10798]: (style) C-style pointer casting [staging/src/imm/immnd/ImmModel.cc:11027]: (style) C-style pointer casting [staging/src/imm/immnd/ImmModel.cc:12510]: (style) C-style pointer casting [staging/src/imm/immnd/ImmModel.cc:13921]: (style) C-style pointer casting [staging/src/imm/immnd/ImmModel.cc:2980] -> [staging/src/imm/immnd/ImmModel.cc:2984]: (style) Variable 'immObject' is reassigned a value before the old one has been used. [staging/src/imm/immnd/ImmModel.cc:7141] -> [staging/src/imm/immnd/ImmModel.cc:7154]: (style) Variable 'current' is reassigned a value before the old one has been used. [staging/src/imm/immnd/ImmModel.cc:7445] -> [staging/src/imm/immnd/ImmModel.cc:7455]: (style) Variable 'ccb' is reassigned a value before the old one has been used. [staging/src/imm/immnd/ImmModel.cc:7448] -> [staging/src/imm/immnd/ImmModel.cc:7460]: (style) Variable 'oMut' is reassigned a value before the old one has been used. [staging/src/imm/immnd/ImmModel.cc:7541] -> [staging/src/imm/immnd/ImmModel.cc:7550]: (style) Variable 'afim' is reassigned a value before the old one has been used. [staging/src/imm/immnd/ImmModel.cc:7579] -> [staging/src/imm/immnd/ImmModel.cc:7589]: (style) Variable 'afim' is reassigned a value before the old one has been used. [staging/src/imm/immnd/ImmModel.cc:14144] -> [staging/src/imm/immnd/ImmModel.cc:14148]: (style) Variable 'immObject' is reassigned a value before the old one has been used. [staging/src/imm/immnd/ImmModel.cc:673]: (style) The scope of the variable 'ix' can be reduced. [staging/src/imm/immnd/ImmModel.cc:905]: (style) The scope of the variable 'ix' can be reduced. [staging/src/imm/immnd/ImmModel.cc:931]: (style) The scope of the variable 'ix' can be reduced. [staging/src/imm/immnd/ImmModel.cc:1041]: (style) The scope of the variable 'ix' can be reduced. [staging/src/imm/immnd/ImmModel.cc:1074]: (style) The scope of the variable 'ix' can be reduced. [staging/src/imm/immnd/ImmModel.cc:1882]: (style) The scope of the variable 'ix' can be reduced. [staging/src/imm/immnd/ImmModel.cc:2031]: (style) The scope of the variable 'ix' can be reduced. [staging/src/imm/immnd/ImmModel.cc:5462]: (style) The scope of the variable 'ai' can be reduced. [staging/src/imm/immnd/ImmModel.cc:16545]: (style) The scope of the variable 'sendCompletedToSlave' can be reduced. [staging/src/imm/immnd/ImmModel.cc:19363]: (style) Unused variable: i3 [staging/src/imm/immnd/ImmModel.cc:104]: (style) Struct 'ImplementerCcbAssociation' has a constructor with 1 argument that is not explicit. [staging/src/imm/immnd/ImmModel.cc:118]: (style) Struct 'ClassInfo' has a constructor with 1 argument that is not explicit. [staging/src/imm/immnd/ImmModel.cc:269]: (style) Struct 'ObjectMutation' has a constructor with 1 argument that is not explicit. [staging/src/imm/immnd/ImmModel.cc:576]: (style) Struct 'AttrFlagIncludes' has a constructor with 1 argument that is not explicit. [staging/src/imm/immnd/ImmModel.cc:587]: (style) Struct 'IdIs' has a constructor with 1 argument that is not explicit. [staging/src/imm/immnd/ImmModel.cc:598]: (style) Struct 'CcbIdIs' has a constructor with 1 argument that is not explicit. [staging/src/imm/immnd/ImmModel.cc:4862]: (style) Struct 'AttrDescriptionGet' has a constructor with 1 argument that is not explicit. [staging/src/imm/immnd/ImmModel.cc:10556]: (error) Common realloc mistake: 'fmtError' nulled but not freed upon failure [staging/src/imm/immnd/immnd_clm.c:165] -> [staging/src/imm/immnd/immnd_clm.c:169]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/imm/immnd/immnd_db.c:85] -> [staging/src/imm/immnd/immnd_db.c:89]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/imm/immnd/immnd_db.c:107] -> [staging/src/imm/immnd/immnd_db.c:109]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/imm/immnd/immnd_evt.c:1040] -> [staging/src/imm/immnd/immnd_evt.c:1041]: (style) Variable 'tmp_hdl' is reassigned a value before the old one has been used. [staging/src/imm/immnd/immnd_evt.c:1381] -> [staging/src/imm/immnd/immnd_evt.c:1388]: (style) Variable 'al' is reassigned a value before the old one has been used. [staging/src/imm/immnd/immnd_evt.c:4472] -> [staging/src/imm/immnd/immnd_evt.c:4475]: (style) Variable 'err' is reassigned a value before the old one has been used. [staging/src/imm/immnd/immnd_evt.c:5126] -> [staging/src/imm/immnd/immnd_evt.c:5134]: (style) Variable 'async' is reassigned a value before the old one has been used. [staging/src/imm/immnd/immnd_evt.c:10322] -> [staging/src/imm/immnd/immnd_evt.c:10329]: (style) Variable 'err' is reassigned a value before the old one has been used. [staging/src/imm/immnd/immnd_evt.c:10490] -> [staging/src/imm/immnd/immnd_evt.c:10490]: (style) Same expression on both sides of '||'. [staging/src/imm/immnd/immnd_evt.c:6242]: (style) The scope of the variable 'ix' can be reduced. [staging/src/imm/immnd/immnd_evt.c:6508]: (style) The scope of the variable 'ix' can be reduced. [staging/src/imm/immnd/immnd_evt.c:8948]: (style) The scope of the variable 'pbeFileSuffix' can be reduced. [staging/src/imm/immnd/immnd_evt.c:5492]: (style) Variable 'implHandle' is assigned a value that is never used. [staging/src/imm/immnd/immnd_evt.c:5638]: (style) Variable 'implHandle' is assigned a value that is never used. [staging/src/imm/immnd/immnd_evt.c:7767]: (style) Variable 'err' is assigned a value that is never used. [staging/src/imm/immnd/immnd_main.c:85] -> [staging/src/imm/immnd/immnd_main.c:87]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/imm/immnd/immnd_mds.c:124] -> [staging/src/imm/immnd/immnd_mds.c:131]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/imm/immnd/immnd_mds.c:326]: (style) The scope of the variable 'evt' can be reduced. [staging/src/imm/immnd/immnd_mds.c:422]: (style) The scope of the variable 'evt' can be reduced. [staging/src/imm/immnd/immnd_proc.c:48]: (style) Assignment of function parameter has no effect outside the function. [staging/src/imm/immnd/immnd_proc.c:748] -> [staging/src/imm/immnd/immnd_proc.c:754]: (style) Variable 'implHandle' is reassigned a value before the old one has been used. [staging/src/imm/immnd/immnd_proc.c:1157]: (style) The scope of the variable 'ix' can be reduced. [staging/src/imm/immnd/ImmModel.cc:1161]: (style) The function 'immModel_protocol51Allowed' is never used. [staging/src/imm/immnd/immnd_db.c:165]: (style) The function 'immnd_client_node_tree_destroy' is never used. [staging/src/imm/immnd/immnd_db.c:289]: (style) The function 'immnd_clm_node_destroy' is never used. [staging/src/imm/immnd/immnd_proc.c:62]: (style) The function 'immnd_proc_immd_down' is never used. (information) Cppcheck cannot find all the include files (use --check-config for details) [staging/src/imm/immd/immd_db.c:250] -> [staging/src/imm/immd/immd_db.c:252]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_db.c:318] -> [staging/src/imm/immd/immd_db.c:331]: (style) Variable 'prior' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_db.c:317]: (style) The scope of the variable 'nrof_msgs' can be reduced. [staging/src/imm/immd/immd_evt.c:530] -> [staging/src/imm/immd/immd_evt.c:547]: (style) Variable 'proc_rc' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_evt.c:645] -> [staging/src/imm/immd/immd_evt.c:655]: (style) Variable 'proc_rc' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_evt.c:2063] -> [staging/src/imm/immd/immd_evt.c:2077]: (style) Variable 'proc_rc' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_evt.c:2133] -> [staging/src/imm/immd/immd_evt.c:2148]: (style) Variable 'proc_rc' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_evt.c:2202] -> [staging/src/imm/immd/immd_evt.c:2217]: (style) Variable 'proc_rc' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_evt.c:2271] -> [staging/src/imm/immd/immd_evt.c:2286]: (style) Variable 'proc_rc' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_evt.c:2444] -> [staging/src/imm/immd/immd_evt.c:2472]: (style) Variable 'proc_rc' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_evt.c:1316]: (style) The scope of the variable 'oldPid' can be reduced. [staging/src/imm/immd/immd_evt.c:1316]: (style) The scope of the variable 'newPid' can be reduced. [staging/src/imm/immd/immd_evt.c:1317]: (style) The scope of the variable 'oldEpoch' can be reduced. [staging/src/imm/immd/immd_evt.c:1317]: (style) The scope of the variable 'newEpoch' can be reduced. [staging/src/imm/immd/immd_mbcsv.c:44] -> [staging/src/imm/immd/immd_mbcsv.c:59]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_mbcsv.c:82] -> [staging/src/imm/immd/immd_mbcsv.c:98]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_mbcsv.c:121] -> [staging/src/imm/immd/immd_mbcsv.c:124]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_mds.c:59] -> [staging/src/imm/immd/immd_mds.c:72]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_mds.c:96] -> [staging/src/imm/immd/immd_mds.c:102]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_mds.c:541] -> [staging/src/imm/immd/immd_mds.c:547]: (style) Variable 'evt' is reassigned a value before the old one has been used. [staging/src/imm/immd/immd_mds.c:333]: (style) The scope of the variable 'evt' can be reduced. [staging/src/imm/immd/immd_db.c:284]: (style) The function 'immd_cb_db_destroy' is never used. [staging/src/imm/immd/immd_mds.c:667]: (style) The function 'immd_mds_msg_sync_send' is never used. [staging/src/imm/immd/immd_mds.c:625]: (style) The function 'immd_mds_send_rsp' is never used. (information) Cppcheck cannot find all the include files (use --check-config for details) [staging/src/imm/agent/imma_db.cc:1289] -> [staging/src/imm/agent/imma_db.cc:1298]: (warning) Either the condition 'if(search_node)' is redundant or there is possible null pointer dereference: search_node. [staging/src/imm/agent/imma_db.cc:1290] -> [staging/src/imm/agent/imma_db.cc:1298]: (warning) Either the condition 'if(search_node)' is redundant or there is possible null pointer dereference: search_node. [staging/src/imm/agent/imma_db.cc:264]: (style) C-style pointer casting [staging/src/imm/agent/imma_db.cc:604] -> [staging/src/imm/agent/imma_db.cc:605]: (style) Variable 'attributes' is reassigned a value before the old one has been used. [staging/src/imm/agent/imma_mds.cc:160] -> [staging/src/imm/agent/imma_mds.cc:170]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/imm/agent/imma_mds.cc:268]: (style) The scope of the variable 'evt' can be reduced. [staging/src/imm/agent/imma_oi_api.cc:120] -> [staging/src/imm/agent/imma_oi_api.cc:130]: (style) Variable 'proc_rc' is reassigned a value before the old one has been used. [staging/src/imm/agent/imma_oi_api.cc:2044]: (style) Variable 'objName' is assigned a value that is never used. [staging/src/imm/agent/imma_oi_api.cc:2265]: (style) Variable 'objName' is assigned a value that is never used. [staging/src/imm/agent/imma_oi_api.cc:2470]: (style) Variable 'objName' is assigned a value that is never used. [staging/src/imm/agent/imma_oi_api.cc:3155]: (style) Variable 'objName' is assigned a value that is never used. [staging/src/imm/agent/imma_om_api.cc:5779] -> [staging/src/imm/agent/imma_om_api.cc:5792]: (warning) Either the condition 'if(cl_node&&cl_node.isOm)' is redundant or there is possible null pointer dereference: cl_node. [staging/src/imm/agent/imma_om_api.cc:233] -> [staging/src/imm/agent/imma_om_api.cc:240]: (style) Variable 'proc_rc' is reassigned a value before the old one has been used. [staging/src/imm/agent/imma_om_api.cc:9829] -> [staging/src/imm/agent/imma_om_api.cc:9836]: (style) Variable 'locked' is reassigned a value before the old one has been used. [staging/src/imm/agent/imma_proc.cc:1471] -> [staging/src/imm/agent/imma_proc.cc:1474]: (style) Variable 'cb_info' is reassigned a value before the old one has been used. [staging/src/imm/agent/imma_proc.cc:2299] -> [staging/src/imm/agent/imma_proc.cc:2306]: (style) Variable 'locked' is reassigned a value before the old one has been used. [staging/src/imm/agent/imma_proc.cc:2577] -> [staging/src/imm/agent/imma_proc.cc:2584]: (style) Variable 'locked' is reassigned a value before the old one has been used. [staging/src/imm/agent/imma_proc.cc:2736] -> [staging/src/imm/agent/imma_proc.cc:2743]: (style) Variable 'locked' is reassigned a value before the old one has been used. [staging/src/imm/agent/imma_proc.cc:2972] -> [staging/src/imm/agent/imma_proc.cc:2979]: (style) Variable 'locked' is reassigned a value before the old one has been used. [staging/src/imm/agent/imma_proc.cc:2389]: (style) The scope of the variable 'i' can be reduced. [staging/src/imm/agent/imma_proc.cc:2780]: (style) The scope of the variable 'i' can be reduced. [staging/src/imm/agent/imma_db.cc:919]: (style) The function 'imma_admin_owner_node_getnext' is never used. [staging/src/imm/agent/imma_db.cc:1078]: (style) The function 'imma_ccb_node_getnext' is never used. [staging/src/imm/agent/imma_db.cc:1226]: (style) The function 'imma_search_node_getnext' is never used. [staging/src/imm/agent/imma_om_api.cc:6965]: (style) The function 'immsv_finalize_sync' is never used. [staging/src/imm/agent/imma_om_api.cc:6688]: (style) The function 'immsv_sync' is never used. [staging/src/imm/agent/imma_oi_api.cc:906]: (style) The function 'saImmOiAdminOperationResult_o2' is never used. [staging/src/imm/agent/imma_oi_api.cc:3708]: (style) The function 'saImmOiAugmentCcbInitialize' is never used. [staging/src/imm/agent/imma_oi_api.cc:3530]: (style) The function 'saImmOiCcbSetErrorString' is never used. [staging/src/imm/agent/imma_oi_api.cc:1851]: (style) The function 'saImmOiClassImplementerRelease' is never used. [staging/src/imm/agent/imma_oi_api.cc:1665]: (style) The function 'saImmOiClassImplementerSet' is never used. [staging/src/imm/agent/imma_oi_api.cc:531]: (style) The function 'saImmOiDispatch' is never used. [staging/src/imm/agent/imma_oi_api.cc:690]: (style) The function 'saImmOiFinalize' is never used. [staging/src/imm/agent/imma_oi_api.cc:1509]: (style) The function 'saImmOiImplementerClear' is never used. [staging/src/imm/agent/imma_oi_api.cc:76]: (style) The function 'saImmOiInitialize_2' is never used. [staging/src/imm/agent/imma_oi_api.cc:90]: (style) The function 'saImmOiInitialize_o3' is never used. [staging/src/imm/agent/imma_oi_api.cc:2250]: (style) The function 'saImmOiObjectImplementerRelease' is never used. [staging/src/imm/agent/imma_oi_api.cc:2274]: (style) The function 'saImmOiObjectImplementerRelease_o3' is never used. [staging/src/imm/agent/imma_oi_api.cc:2029]: (style) The function 'saImmOiObjectImplementerSet' is never used. [staging/src/imm/agent/imma_oi_api.cc:2053]: (style) The function 'saImmOiObjectImplementerSet_o3' is never used. [staging/src/imm/agent/imma_oi_api.cc:2793]: (style) The function 'saImmOiRtObjectCreate_2' is never used. [staging/src/imm/agent/imma_oi_api.cc:2805]: (style) The function 'saImmOiRtObjectCreate_o3' is never used. [staging/src/imm/agent/imma_oi_api.cc:3140]: (style) The function 'saImmOiRtObjectDelete' is never used. [staging/src/imm/agent/imma_oi_api.cc:3164]: (style) The function 'saImmOiRtObjectDelete_o3' is never used. [staging/src/imm/agent/imma_oi_api.cc:2454]: (style) The function 'saImmOiRtObjectUpdate_2' is never used. [staging/src/imm/agent/imma_oi_api.cc:2479]: (style) The function 'saImmOiRtObjectUpdate_o3' is never used. [staging/src/imm/agent/imma_oi_api.cc:424]: (style) The function 'saImmOiSelectionObjectGet' is never used. [staging/src/imm/agent/imma_om_api.cc:5819]: (style) The function 'saImmOmAccessorGet_2' is never used. [staging/src/imm/agent/imma_om_api.cc:4659]: (style) The function 'saImmOmAdminOperationContinuationClear' is never used. [staging/src/imm/agent/imma_om_api.cc:4666]: (style) The function 'saImmOmAdminOperationContinuationClear_o3' is never used. [staging/src/imm/agent/imma_om_api.cc:4612]: (style) The function 'saImmOmAdminOperationContinue' is never used. [staging/src/imm/agent/imma_om_api.cc:4643]: (style) The function 'saImmOmAdminOperationContinueAsync' is never used. [staging/src/imm/agent/imma_om_api.cc:4651]: (style) The function 'saImmOmAdminOperationContinueAsync_o3' is never used. [staging/src/imm/agent/imma_om_api.cc:4620]: (style) The function 'saImmOmAdminOperationContinue_o2' is never used. [staging/src/imm/agent/imma_om_api.cc:4631]: (style) The function 'saImmOmAdminOperationContinue_o3' is never used. [staging/src/imm/agent/imma_om_api.cc:4252]: (style) The function 'saImmOmAdminOperationInvokeAsync_2' is never used. [staging/src/imm/agent/imma_om_api.cc:4290]: (style) The function 'saImmOmAdminOperationInvokeAsync_o3' is never used. [staging/src/imm/agent/imma_om_api.cc:3629]: (style) The function 'saImmOmAdminOperationInvoke_2' is never used. [staging/src/imm/agent/imma_om_api.cc:3669]: (style) The function 'saImmOmAdminOperationInvoke_o2' is never used. [staging/src/imm/agent/imma_om_api.cc:3709]: (style) The function 'saImmOmAdminOperationInvoke_o3' is never used. [staging/src/imm/agent/imma_om_api.cc:4110]: (style) The function 'saImmOmAdminOperationMemoryFree' is never used. [staging/src/imm/agent/imma_om_api.cc:8624]: (style) The function 'saImmOmAdminOwnerClear' is never used. [staging/src/imm/agent/imma_om_api.cc:8665]: (style) The function 'saImmOmAdminOwnerClear_o3' is never used. [staging/src/imm/agent/imma_om_api.cc:8835]: (style) The function 'saImmOmAdminOwnerFinalize' is never used. [staging/src/imm/agent/imma_om_api.cc:8374]: (style) The function 'saImmOmAdminOwnerRelease' is never used. [staging/src/imm/agent/imma_om_api.cc:8413]: (style) The function 'saImmOmAdminOwnerRelease_o3' is never used. [staging/src/imm/agent/imma_om_api.cc:8115]: (style) The function 'saImmOmAdminOwnerSet' is never used. [staging/src/imm/agent/imma_om_api.cc:8154]: (style) The function 'saImmOmAdminOwnerSet_o3' is never used. [staging/src/imm/agent/imma_om_api.cc:3544]: (style) The function 'saImmOmCcbAbort' is never used. [staging/src/imm/agent/imma_om_api.cc:3080]: (style) The function 'saImmOmCcbApply' is never used. [staging/src/imm/agent/imma_om_api.cc:9233]: (style) The function 'saImmOmCcbFinalize' is never used. [staging/src/imm/agent/imma_om_api.cc:9537]: (style) The function 'saImmOmCcbGetErrorStrings' is never used. [staging/src/imm/agent/imma_om_api.cc:1362]: (style) The function 'saImmOmCcbInitialize' is never used. [staging/src/imm/agent/imma_om_api.cc:1615]: (style) The function 'saImmOmCcbObjectCreate_2' is never used. [staging/src/imm/agent/imma_om_api.cc:1627]: (style) The function 'saImmOmCcbObjectCreate_o3' is never used. [staging/src/imm/agent/imma_om_api.cc:2694]: (style) The function 'saImmOmCcbObjectDelete' is never used. [staging/src/imm/agent/imma_om_api.cc:2726]: (style) The function 'saImmOmCcbObjectDelete_o3' is never used. [staging/src/imm/agent/imma_om_api.cc:2193]: (style) The function 'saImmOmCcbObjectModify_2' is never used. [staging/src/imm/agent/imma_om_api.cc:2226]: (style) The function 'saImmOmCcbObjectModify_o3' is never used. [staging/src/imm/agent/imma_om_api.cc:6337]: (style) The function 'saImmOmCcbObjectRead' is never used. [staging/src/imm/agent/imma_om_api.cc:3592]: (style) The function 'saImmOmCcbValidate' is never used. [staging/src/imm/agent/imma_om_api.cc:4674]: (style) The function 'saImmOmClassCreate_2' is never used. [staging/src/imm/agent/imma_om_api.cc:5476]: (style) The function 'saImmOmClassDelete' is never used. [staging/src/imm/agent/imma_om_api.cc:5064]: (style) The function 'saImmOmClassDescriptionGet_2' is never used. [staging/src/imm/agent/imma_om_api.cc:5417]: (style) The function 'saImmOmClassDescriptionMemoryFree_2' is never used. [staging/src/imm/agent/imma_om_api.cc:602]: (style) The function 'saImmOmDispatch' is never used. [staging/src/imm/agent/imma_om_api.cc:160]: (style) The function 'saImmOmInitialize' is never used. [staging/src/imm/agent/imma_om_api.cc:7931]: (style) The function 'saImmOmSearchFinalize' is never used. [staging/src/imm/agent/imma_om_api.cc:7080]: (style) The function 'saImmOmSearchInitialize_2' is never used. [staging/src/imm/agent/imma_om_api.cc:7118]: (style) The function 'saImmOmSearchInitialize_o3' is never used. [staging/src/imm/agent/imma_om_api.cc:7568]: (style) The function 'saImmOmSearchNext_2' is never used. [staging/src/imm/agent/imma_om_api.cc:7587]: (style) The function 'saImmOmSearchNext_o3' is never used. [staging/src/imm/agent/imma_om_api.cc:482]: (style) The function 'saImmOmSelectionObjectGet' is never used. (information) Cppcheck cannot find all the include files (use --check-config for details) diff --git a/src/imm/agent/imma_db.cc b/src/imm/agent/imma_db.cc --- a/src/imm/agent/imma_db.cc +++ b/src/imm/agent/imma_db.cc @@ -601,8 +601,7 @@ int imma_oi_ccb_record_note_callback(IMM } if(callback){ if(callback->type == IMMA_CALLBACK_OI_CCB_CREATE && !(tmp->adminOwner)) { - SaImmAttrValuesT_2 **attributes = NULL; - attributes = (SaImmAttrValuesT_2 **) callback->attrValsForCreateUc; + SaImmAttrValuesT_2 **attributes = (SaImmAttrValuesT_2 **) callback->attrValsForCreateUc; int i=0; while((attrVal = attributes[i++]) != NULL) { if(strcmp(admoNameAttr, attrVal->attrName)==0) { @@ -1294,10 +1293,7 @@ uint32_t imma_search_node_delete(IMMA_CB rc = NCSCC_RC_FAILURE; } - /* Free the Node */ - if (search_node) { - free(search_node); - } + free(search_node); return rc; } diff --git a/src/imm/agent/imma_mds.cc b/src/imm/agent/imma_mds.cc --- a/src/imm/agent/imma_mds.cc +++ b/src/imm/agent/imma_mds.cc @@ -157,7 +157,6 @@ uint32_t imma_mds_register(IMMA_CB *cb) void imma_mds_unregister(IMMA_CB *cb) { NCSMDS_INFO arg; - uint32_t rc = NCSCC_RC_SUCCESS; /* Un-install your service into MDS. No need to cancel the services that are subscribed */ @@ -167,7 +166,7 @@ void imma_mds_unregister(IMMA_CB *cb) arg.i_svc_id = cb->sv_id; arg.i_op = MDS_UNINSTALL; - rc = ncsmds_api(&arg); + uint32_t rc = ncsmds_api(&arg); if (rc != NCSCC_RC_SUCCESS) { TRACE_3("MDS unregister failed"); @@ -265,7 +264,6 @@ uint32_t imma_mds_callback(struct ncsmds ******************************************************************************/ static uint32_t imma_mds_enc_flat(IMMA_CB *cb, MDS_CALLBACK_ENC_FLAT_INFO *info) { - IMMSV_EVT *evt; NCS_UBAID *uba = info->io_uba; uint32_t rc = NCSCC_RC_SUCCESS; @@ -283,7 +281,7 @@ static uint32_t imma_mds_enc_flat(IMMA_C #endif /*ABT DOES NOT WORK */ /* as all the event structures are flat */ - evt = (IMMSV_EVT *)info->i_msg; + IMMSV_EVT *evt = (IMMSV_EVT *)info->i_msg; rc = immsv_evt_enc_flat( /*&cb->edu_hdl, */ evt, uba); if (rc != NCSCC_RC_SUCCESS) { TRACE_3("Mds encode flat failed rc:%u", rc); diff --git a/src/imm/agent/imma_oi_api.cc b/src/imm/agent/imma_oi_api.cc --- a/src/imm/agent/imma_oi_api.cc +++ b/src/imm/agent/imma_oi_api.cc @@ -117,7 +117,6 @@ SaAisErrorT initialize_common(SaImmOiHan SaAisErrorT rc = SA_AIS_OK; IMMSV_EVT init_evt; IMMSV_EVT *out_evt = NULL; - uint32_t proc_rc = NCSCC_RC_SUCCESS; IMMA_CLIENT_NODE *cl_node = 0; bool locked = true; SaVersionT requested_version; @@ -127,7 +126,7 @@ SaAisErrorT initialize_common(SaImmOiHan *client_node = NULL; - proc_rc = imma_startup(NCSMDS_SVC_ID_IMMA_OI); + uint32_t proc_rc = imma_startup(NCSMDS_SVC_ID_IMMA_OI); if (NCSCC_RC_SUCCESS != proc_rc) { TRACE_4("ERR_LIBRARY: Agents_startup failed"); TRACE_LEAVE(); diff --git a/src/imm/agent/imma_om_api.cc b/src/imm/agent/imma_om_api.cc --- a/src/imm/agent/imma_om_api.cc +++ b/src/imm/agent/imma_om_api.cc @@ -230,14 +230,13 @@ static SaAisErrorT initialize_common(SaI SaAisErrorT rc = SA_AIS_OK; IMMSV_EVT init_evt; IMMSV_EVT *out_evt = NULL; - uint32_t proc_rc = NCSCC_RC_SUCCESS; bool locked = true; char *timeout_env_value = NULL; char *value; TRACE_ENTER(); osafassert(immHandle && cl_node); - proc_rc = imma_startup(NCSMDS_SVC_ID_IMMA_OM); + uint32_t proc_rc = imma_startup(NCSMDS_SVC_ID_IMMA_OM); if (NCSCC_RC_SUCCESS != proc_rc) { TRACE_4("ERR_LIBRARY: imma startup failed:%u", proc_rc); rc = SA_AIS_ERR_LIBRARY; @@ -5776,7 +5775,13 @@ SaAisErrorT saImmOmAccessorFinalize(SaIm immHandle = search_node->mImmHandle; imma_client_node_get(&cb->client_tree, &immHandle, &cl_node); - if(cl_node->isImmA2x12 && cl_node->clmExposed){ + if (cl_node == nullptr) { + TRACE_2("SA_AIS_ERR_BAD_HANDLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_BAD_HANDLE; + goto release_lock; + } + + if((cl_node->isImmA2x12) && (cl_node->clmExposed)){ TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); rc = SA_AIS_ERR_UNAVAILABLE; goto clm_left; @@ -5789,7 +5794,7 @@ SaAisErrorT saImmOmAccessorFinalize(SaIm rc = SA_AIS_ERR_LIBRARY; } else { /* Decrease number of search handles per IMM handle */ - if (cl_node && cl_node->isOm) { /* TODO: Is osafassert(cl_node && cl_node->isOm) better solution */ + if (cl_node->isOm) { /* TODO: Is osafassert(cl_node && cl_node->isOm) better solution */ osafassert(cl_node->searchHandleSize); cl_node->searchHandleSize--; } else { @@ -9826,14 +9831,12 @@ SaAisErrorT immsv_om_augment_ccb_get_res { SaAisErrorT rc = SA_AIS_OK; IMMA_CB *cb = &imma_cb; - bool locked = false; IMMA_CCB_NODE *ccb_node = NULL; SaImmCcbHandleT ccbHandle = privateOmHandle; /* Same value */ TRACE_ENTER(); osafassert(cb->sv_id != 0); osafassert(m_NCS_LOCK(&cb->cb_lock, NCS_LOCK_WRITE) == NCSCC_RC_SUCCESS); - locked = true; /* Get the CCB info */ imma_ccb_node_get(&cb->ccb_tree, &ccbHandle, &ccb_node); @@ -9850,9 +9853,7 @@ SaAisErrorT immsv_om_augment_ccb_get_res } done: - if (locked) { - m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); - } + m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); TRACE_LEAVE(); return rc; diff --git a/src/imm/agent/imma_proc.cc b/src/imm/agent/imma_proc.cc --- a/src/imm/agent/imma_proc.cc +++ b/src/imm/agent/imma_proc.cc @@ -1468,10 +1468,8 @@ void imma_process_evt(IMMA_CB *cb, IMMSV ******************************************************************************/ IMMA_CALLBACK_INFO *imma_callback_ipc_rcv(IMMA_CLIENT_NODE *cl_node) { - IMMA_CALLBACK_INFO *cb_info = NULL; - /* remove it to the queue */ - cb_info = (IMMA_CALLBACK_INFO *) + IMMA_CALLBACK_INFO *cb_info = (IMMA_CALLBACK_INFO *) m_NCS_IPC_NON_BLK_RECEIVE(&cl_node->callbk_mbx, NULL); return cb_info; @@ -2386,7 +2384,6 @@ static bool imma_process_callback_info(I IMMSV_EVT ccbObjCrRpl; bool locked = false; SaImmAttrValuesT_2 **attr = NULL; - int i = 0; /* No need to check for o.iCallbkA2f.saImmOiCcbObjectCreateCallback * "o" is union and o.iCallbk.saImmOiCcbObjectCreateCallback is same * as o.iCallbkA2f.saImmOiCcbObjectCreateCallback */ @@ -2506,7 +2503,7 @@ static bool imma_process_callback_info(I free(className); /*free-0 */ free(objectName); /*free-6 */ attr = (SaImmAttrValuesT_2 **) callback->attrValsForCreateUc; - for (i = 0; attr[i]; ++i) { + for (int i = 0; attr[i]; ++i) { free(attr[i]->attrName); /*free-3 */ attr[i]->attrName = 0; if (attr[i]->attrValuesNumber) { @@ -2777,7 +2774,6 @@ static bool imma_process_callback_info(I IMMSV_EVT ccbObjModRpl; bool locked = false; SaImmAttrModificationT_2 **attr = NULL; - int i = 0; if (cl_node->o.iCallbk.saImmOiCcbObjectModifyCallback) { /* Anoying type diff for ccbid between OM and OI */ SaImmOiCcbIdT ccbid = 0LL; @@ -2804,7 +2800,7 @@ static bool imma_process_callback_info(I /*alloc-1 */ attr = (SaImmAttrModificationT_2 **) calloc(noOfAttrMods + 1, sizeof(SaImmAttrModificationT_2 *)); p = callback->attrMods; - for (; i < noOfAttrMods; i++, p = p->next) { + for (int i = 0; i < noOfAttrMods; i++, p = p->next) { attr[i] = (SaImmAttrModificationT_2 *) calloc(1, sizeof(SaImmAttrModificationT_2)); /*alloc-2 */ attr[i]->modType = (SaImmAttrModificationTypeT) p->attrModType; @@ -2899,7 +2895,7 @@ static bool imma_process_callback_info(I localEr = SA_AIS_ERR_FAILED_OPERATION; } - for (i = 0; attr[i]; ++i) { + for (int i = 0; attr[i]; ++i) { free(attr[i]->modAttr.attrName); /*free-3 */ attr[i]->modAttr.attrName = 0; if (attr[i]->modAttr.attrValuesNumber) { diff --git a/src/imm/immd/immd_db.c b/src/imm/immd/immd_db.c --- a/src/imm/immd/immd_db.c +++ b/src/imm/immd/immd_db.c @@ -247,9 +247,7 @@ void immd_immnd_info_tree_destroy(IMMD_C *****************************************************************************/ uint32_t immd_cb_db_init(IMMD_CB *cb) { - uint32_t rc = NCSCC_RC_SUCCESS; - - rc = immd_immnd_info_tree_init(cb); + uint32_t rc = immd_immnd_info_tree_init(cb); if (rc != NCSCC_RC_SUCCESS) { LOG_ER("IMMD - IMMND INFO TREE INIT FAILED"); return rc; @@ -314,8 +312,6 @@ uint32_t immd_get_slot_and_subslot_id_fr void immd_db_save_fevs(IMMD_CB *cb, IMMSV_FEVS *fevs_msg) { - uint16_t nrof_msgs = 1; - IMMD_SAVED_FEVS_MSG *prior = NULL; IMMD_SAVED_FEVS_MSG *new_msg = calloc(1, sizeof(IMMD_SAVED_FEVS_MSG)); TRACE_ENTER(); osafassert(new_msg); @@ -328,8 +324,9 @@ void immd_db_save_fevs(IMMD_CB *cb, IMMS fevs_msg->msg.buf = NULL; /* steal the message */ fevs_msg->msg.size = 0; - prior = cb->saved_msgs; + IMMD_SAVED_FEVS_MSG *prior = cb->saved_msgs; if (prior) { + uint16_t nrof_msgs = 1; while (prior->next) { ++nrof_msgs; prior = prior->next; diff --git a/src/imm/immd/immd_evt.c b/src/imm/immd/immd_evt.c --- a/src/imm/immd/immd_evt.c +++ b/src/imm/immd/immd_evt.c @@ -527,7 +527,6 @@ static int immd_dump_ok(IMMD_CB *cb, SaU static void immd_announce_load_ok(IMMD_CB *cb, SaUint32T rulingEpoch) { - uint32_t proc_rc = NCSCC_RC_SUCCESS; IMMSV_EVT load_evt; TRACE_ENTER(); @@ -544,7 +543,7 @@ static void immd_announce_load_ok(IMMD_C load_evt.info.immnd.info.ctrl.fevsMsgStart = cb->fevsSendCount; /*Use fevs instead !! */ - proc_rc = immd_mds_bcast_send(cb, &load_evt, NCSMDS_SVC_ID_IMMND); + uint32_t proc_rc = immd_mds_bcast_send(cb, &load_evt, NCSMDS_SVC_ID_IMMND); if (proc_rc != NCSCC_RC_SUCCESS) { LOG_WA("Failed to send message to IMMNDs"); @@ -642,7 +641,6 @@ static void immd_req_sync(IMMD_CB *cb, I static void immd_kill_node(IMMD_CB *cb, IMMD_IMMND_INFO_NODE *node_info) { - uint32_t proc_rc = NCSCC_RC_SUCCESS; IMMSV_EVT kill_evt; TRACE_ENTER(); memset(&kill_evt, 0, sizeof(IMMSV_EVT)); @@ -652,7 +650,7 @@ static void immd_kill_node(IMMD_CB *cb, kill_evt.info.immnd.type = IMMND_EVT_D2ND_INTRO_RSP; kill_evt.info.immnd.info.ctrl.nodeId = node_info->immnd_key; - proc_rc = immd_mds_msg_send(cb, NCSMDS_SVC_ID_IMMND, node_info->immnd_dest, &kill_evt); + uint32_t proc_rc = immd_mds_msg_send(cb, NCSMDS_SVC_ID_IMMND, node_info->immnd_dest, &kill_evt); if (proc_rc != NCSCC_RC_SUCCESS) { LOG_WA("Failed to send INTRO_RSP to IMMND %x", node_info->immnd_key); } @@ -671,7 +669,6 @@ static uint16_t accepted_nodes = 0; static void immd_accept_node(IMMD_CB *cb, IMMD_IMMND_INFO_NODE *node_info, bool doReply, bool knownVeteran) { - uint32_t proc_rc = NCSCC_RC_SUCCESS; IMMSV_EVT accept_evt; IMMD_MBCSV_MSG mbcp_msg; bool isOnController = node_info->isOnController; @@ -761,7 +758,7 @@ static void immd_accept_node(IMMD_CB *cb /*Checkpoint the message to standby director. Syncronous call=>wait for ack */ - proc_rc = immd_mbcsv_sync_update(cb, &mbcp_msg); + uint32_t proc_rc = immd_mbcsv_sync_update(cb, &mbcp_msg); if (proc_rc != NCSCC_RC_SUCCESS) { if(fsParamMbcp) {cb->mFsParamMbcp = false;} @@ -1313,12 +1310,13 @@ static uint32_t immd_evt_proc_immnd_req_ { uint32_t proc_rc = NCSCC_RC_SUCCESS; IMMD_IMMND_INFO_NODE *node_info = NULL; - int oldPid, newPid; - int oldEpoch, newEpoch; TRACE_ENTER(); immd_immnd_info_node_get(&cb->immnd_tree, &sinfo->dest, &node_info); if (node_info) { + int oldPid, newPid; + int oldEpoch, newEpoch; + oldPid = node_info->immnd_execPid; oldEpoch = node_info->epoch; newPid = evt->info.ctrl_msg.ndExecPid; @@ -2060,7 +2058,6 @@ static uint32_t immd_evt_proc_2pbe_prelo static uint32_t immd_evt_proc_sync_fevs_base(IMMD_CB *cb, IMMD_EVT *evt, IMMSV_SEND_INFO *sinfo) { IMMSV_EVT fevs_evt; - uint32_t proc_rc = NCSCC_RC_SUCCESS; NCS_UBAID uba; char *tmpData = NULL; uba.start = NULL; @@ -2074,7 +2071,7 @@ static uint32_t immd_evt_proc_sync_fevs_ fevs_evt.info.immnd.type = IMMND_EVT_D2ND_SYNC_FEVS_BASE; fevs_evt.info.immnd.info.syncFevsBase = evt->info.syncFevsBase.fevsBase; - proc_rc = ncs_enc_init_space(&uba); + uint32_t proc_rc = ncs_enc_init_space(&uba); if (proc_rc != NCSCC_RC_SUCCESS) { LOG_WA("Failed init ubaid"); goto fail; @@ -2130,7 +2127,6 @@ static uint32_t immd_evt_proc_sync_fevs_ static uint32_t immd_evt_proc_discard_impl(IMMD_CB *cb, IMMD_EVT *evt, IMMSV_SEND_INFO *sinfo) { IMMSV_EVT fevs_evt; - uint32_t proc_rc = NCSCC_RC_SUCCESS; IMMSV_OI_IMPLSET_REQ *impl_req = &evt->info.impl_set.r; NCS_UBAID uba; char *tmpData = NULL; @@ -2145,7 +2141,7 @@ static uint32_t immd_evt_proc_discard_im fevs_evt.info.immnd.type = IMMND_EVT_D2ND_DISCARD_IMPL; fevs_evt.info.immnd.info.implSet.impl_id = impl_req->impl_id; - proc_rc = ncs_enc_init_space(&uba); + uint32_t proc_rc = ncs_enc_init_space(&uba); if (proc_rc != NCSCC_RC_SUCCESS) { LOG_WA("Failed init ubaid"); goto fail; @@ -2199,7 +2195,6 @@ static uint32_t immd_evt_proc_discard_im static uint32_t immd_evt_proc_abort_ccb(IMMD_CB *cb, IMMD_EVT *evt, IMMSV_SEND_INFO *sinfo) { IMMSV_EVT fevs_evt; - uint32_t proc_rc = NCSCC_RC_SUCCESS; SaUint32T ccbId = evt->info.ccbId; NCS_UBAID uba; char *tmpData = NULL; @@ -2214,7 +2209,7 @@ static uint32_t immd_evt_proc_abort_ccb( fevs_evt.info.immnd.type = IMMND_EVT_D2ND_ABORT_CCB; fevs_evt.info.immnd.info.ccbId = ccbId; - proc_rc = ncs_enc_init_space(&uba); + uint32_t proc_rc = ncs_enc_init_space(&uba); if (proc_rc != NCSCC_RC_SUCCESS) { LOG_WA("Failed init ubaid"); goto fail; @@ -2268,7 +2263,6 @@ static uint32_t immd_evt_proc_abort_ccb( static uint32_t immd_evt_proc_admo_hard_finalize(IMMD_CB *cb, IMMD_EVT *evt, IMMSV_SEND_INFO *sinfo) { IMMSV_EVT fevs_evt; - uint32_t proc_rc = NCSCC_RC_SUCCESS; SaUint32T admoId = evt->info.admoId; NCS_UBAID uba; char *tmpData = NULL; @@ -2283,7 +2277,7 @@ static uint32_t immd_evt_proc_admo_hard_ fevs_evt.info.immnd.type = IMMND_EVT_D2ND_ADMO_HARD_FINALIZE; fevs_evt.info.immnd.info.admFinReq.adm_owner_id = admoId; - proc_rc = ncs_enc_init_space(&uba); + uint32_t proc_rc = ncs_enc_init_space(&uba); if (proc_rc != NCSCC_RC_SUCCESS) { LOG_WA("Failed init ubaid"); goto fail; @@ -2441,7 +2435,6 @@ static uint32_t immd_evt_proc_rt_modify_ { IMMSV_EVT fevs_evt; IMMSV_OM_CCB_OBJECT_MODIFY *objModifyReq = &evt->info.objModify; - uint32_t proc_rc = NCSCC_RC_SUCCESS; NCS_UBAID uba; char *tmpData = NULL; @@ -2469,7 +2462,7 @@ static uint32_t immd_evt_proc_rt_modify_ fevs_evt.info.immnd.info.objModify = *objModifyReq; /* Borrow pointer structures. */ - proc_rc = ncs_enc_init_space(&uba); + uint32_t proc_rc = ncs_enc_init_space(&uba); if (proc_rc != NCSCC_RC_SUCCESS) { LOG_WA("Failed init ubaid"); goto fail; diff --git a/src/imm/immd/immd_mbcsv.c b/src/imm/immd/immd_mbcsv.c --- a/src/imm/immd/immd_mbcsv.c +++ b/src/imm/immd/immd_mbcsv.c @@ -41,7 +41,6 @@ static int immd_silence_count = 0; uint32_t immd_mbcsv_sync_update(IMMD_CB *cb, IMMD_MBCSV_MSG *msg) { NCS_MBCSV_ARG arg; - uint32_t rc = SA_AIS_OK; TRACE_ENTER(); /* populate the arg structure */ @@ -56,7 +55,7 @@ uint32_t immd_mbcsv_sync_update(IMMD_CB arg.info.send_ckpt.i_action = NCS_MBCSV_ACT_UPDATE; /*send the message using MBCSv */ - rc = ncs_mbcsv_svc(&arg); + uint32_t rc = ncs_mbcsv_svc(&arg); if (rc != SA_AIS_OK) { LOG_WA("IMMD - MBCSv Sync Update Send Failed"); } @@ -79,7 +78,6 @@ uint32_t immd_mbcsv_sync_update(IMMD_CB uint32_t immd_mbcsv_async_update(IMMD_CB *cb, IMMD_MBCSV_MSG *msg) { NCS_MBCSV_ARG arg; - uint32_t rc = SA_AIS_OK; TRACE_ENTER(); /* populate the arg structure */ @@ -95,7 +93,7 @@ uint32_t immd_mbcsv_async_update(IMMD_CB arg.info.send_ckpt.i_action = NCS_MBCSV_ACT_UPDATE; /*send the message using MBCSv */ - rc = ncs_mbcsv_svc(&arg); + uint32_t rc = ncs_mbcsv_svc(&arg); if (rc != SA_AIS_OK) { LOG_WA("IMMD - MBCSv Async Update Send Failed"); } @@ -118,10 +116,9 @@ uint32_t immd_mbcsv_async_update(IMMD_CB *****************************************************************************/ uint32_t immd_mbcsv_register(IMMD_CB *cb) { - uint32_t rc = NCSCC_RC_SUCCESS; TRACE_ENTER(); - rc = immd_mbcsv_init(cb); + uint32_t rc = immd_mbcsv_init(cb); if (rc != NCSCC_RC_SUCCESS) { TRACE_LEAVE(); return rc; diff --git a/src/imm/immd/immd_mds.c b/src/imm/immd/immd_mds.c --- a/src/imm/immd/immd_mds.c +++ b/src/imm/immd/immd_mds.c @@ -56,7 +56,6 @@ MDS_CLIENT_MSG_FORMAT_VER immd_immnd_msg uint32_t immd_mds_vdest_create(IMMD_CB *cb) { NCSVDA_INFO arg; - uint32_t rc = NCSCC_RC_SUCCESS; memset(&arg, 0, sizeof(arg)); @@ -69,7 +68,7 @@ uint32_t immd_mds_vdest_create(IMMD_CB * arg.info.vdest_create.info.specified.i_vdest = cb->immd_dest_id; /* Create VDEST */ - rc = ncsvda_api(&arg); + uint32_t rc = ncsvda_api(&arg); if (NCSCC_RC_SUCCESS != rc) { LOG_WA("NCSVDA_VDEST_CREATE failed"); return rc; @@ -93,13 +92,12 @@ uint32_t immd_mds_vdest_create(IMMD_CB * ****************************************************************************/ uint32_t immd_mds_register(IMMD_CB *cb, SaAmfHAStateT ha_state) { - uint32_t rc = NCSCC_RC_SUCCESS; NCSMDS_INFO svc_info; MDS_SVC_ID svc_id[1] = { NCSMDS_SVC_ID_IMMND }; MDS_SVC_ID immd_id[1] = { NCSMDS_SVC_ID_IMMD }; /* Create the virtual Destination for IMMD */ - rc = immd_mds_vdest_create(cb); + uint32_t rc = immd_mds_vdest_create(cb); if (NCSCC_RC_SUCCESS != rc) { LOG_ER("IMMD - VDEST CREATE FAILED"); return rc; @@ -330,8 +328,6 @@ uint32_t immd_mds_callback(struct ncsmds ******************************************************************************/ static uint32_t immd_mds_enc(IMMD_CB *cb, MDS_CALLBACK_ENC_INFO *enc_info) { - IMMSV_EVT *evt; - /* Get the Msg Format version from the SERVICE_ID & RMT_SVC_PVT_SUBPART_VERSION */ if (enc_info->i_to_svc_id == NCSMDS_SVC_ID_IMMND) { @@ -347,7 +343,7 @@ static uint32_t immd_mds_enc(IMMD_CB *cb if (1 /*enc_info->o_msg_fmt_ver */ ) { /*Does not work. */ - evt = (IMMSV_EVT *)enc_info->i_msg; + IMMSV_EVT *evt = (IMMSV_EVT *)enc_info->i_msg; return immsv_evt_enc( /*&cb->edu_hdl, */ evt, enc_info->io_uba); @@ -538,13 +534,10 @@ static uint32_t immd_mds_rcv(IMMD_CB *cb *****************************************************************************/ static uint32_t immd_mds_svc_evt(IMMD_CB *cb, MDS_CALLBACK_SVC_EVENT_INFO *svc_evt) { - IMMSV_EVT *evt = NULL; - uint32_t rc; - LOG_NO("MDS event from svc_id %u (change:%d, dest:%" PRIu64 ")", svc_evt->i_svc_id, svc_evt->i_change, svc_evt->i_dest); - evt = calloc(1, sizeof(IMMSV_EVT)); + IMMSV_EVT *evt = calloc(1, sizeof(IMMSV_EVT)); if (!evt) { LOG_ER("IMMD - Evt calloc Failed"); @@ -561,7 +554,7 @@ static uint32_t immd_mds_svc_evt(IMMD_CB evt->info.immd.info.mds_info.node_id = svc_evt->i_node_id; /* Put it in IMMD's Event Queue */ - rc = m_NCS_IPC_SEND(&cb->mbx, (NCSCONTEXT)evt, NCS_IPC_PRIORITY_VERY_HIGH); + uint32_t rc = m_NCS_IPC_SEND(&cb->mbx, (NCSCONTEXT)evt, NCS_IPC_PRIORITY_VERY_HIGH); if (NCSCC_RC_SUCCESS != rc) { LOG_WA("IMMD - IPC SEND FAILED"); free(evt); diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc --- a/src/imm/immnd/ImmModel.cc +++ b/src/imm/immnd/ImmModel.cc @@ -101,7 +101,7 @@ typedef std::map<ImplementerInfo*, Conti struct ImplementerCcbAssociation { - ImplementerCcbAssociation(ImplementerInfo* impl) : mImplementer(impl), + explicit ImplementerCcbAssociation(ImplementerInfo* impl) : mImplementer(impl), mContinuationId(0), mWaitForImplAck(false){} ImplementerInfo* mImplementer; @@ -115,7 +115,7 @@ typedef std::set<ObjectInfo*> ObjectSet; struct ClassInfo { - ClassInfo(SaUint32T category) : mCategory(category), + explicit ClassInfo(SaUint32T category) : mCategory(category), mImplementer(NULL) { } ~ClassInfo() { mCategory = 0; mImplementer=NULL;} @@ -266,7 +266,7 @@ typedef enum { struct ObjectMutation { - ObjectMutation(ImmMutationType opType) : mOpType(opType), + explicit ObjectMutation(ImmMutationType opType) : mOpType(opType), mAfterImage(NULL), mContinuationId(0), mAugmentAdmo(0), @@ -573,7 +573,7 @@ static SaUint32T sTerminatedCcbcount = 0 struct AttrFlagIncludes { - AttrFlagIncludes(SaImmAttrFlagsT attrFlag) : mFlag(attrFlag) { } + explicit AttrFlagIncludes(SaImmAttrFlagsT attrFlag) : mFlag(attrFlag) { } bool operator() (AttrMap::value_type& item) const { return (item.second->mFlags & mFlag) != 0; @@ -584,7 +584,7 @@ struct AttrFlagIncludes struct IdIs { - IdIs(SaUint32T id) : mId(id) { } + explicit IdIs(SaUint32T id) : mId(id) { } bool operator() (AdminOwnerInfo*& item) const { return item->mId == mId; @@ -595,7 +595,7 @@ struct IdIs struct CcbIdIs { - CcbIdIs(SaUint32T id) : mId(id) { } + explicit CcbIdIs(SaUint32T id) : mId(id) { } bool operator() (CcbInfo*& item) const { return item->mId == mId; @@ -670,10 +670,10 @@ immModel_pbePrtoPurgeMutations(IMMND_CB { ConnVector cv; ConnVector::iterator cvi; - unsigned int ix = 0; ImmModel::instance(&cb->immModel)->pbePrtoPurgeMutations(nodeId, cv); *reqArrSize = (SaUint32T) cv.size(); if(*reqArrSize) { + unsigned int ix = 0; *reqConnArr = (SaUint32T *) malloc((*reqArrSize)* sizeof(SaUint32T)); for(cvi = cv.begin(); cvi!= cv.end();++cvi,++ix) { (*reqConnArr)[ix] = (*cvi); @@ -902,7 +902,6 @@ immModel_getLocalAppliersForObj(IMMND_CB { ConnVector cv; ConnVector::iterator cvi; - unsigned int ix = 0; ImmModel::instance(&cb->immModel)-> getLocalAppliersForObj(objName, ccbId, cv, externalRep); @@ -910,6 +909,7 @@ immModel_getLocalAppliersForObj(IMMND_CB SaUint32T arrSize = (SaUint32T) cv.size(); if(arrSize) { + unsigned int ix = 0; *aplConnArr = (SaUint32T *) malloc((arrSize) * sizeof(SaUint32T)); for(cvi = cv.begin(); cvi!=cv.end(); ++cvi, ++ix) { @@ -928,7 +928,6 @@ immModel_getLocalAppliersForCcb(IMMND_CB { ConnVector cv; ConnVector::iterator cvi; - unsigned int ix = 0; ImmModel::instance(&cb->immModel)-> getLocalAppliersForCcb(ccbId, cv, applCtnPtr); @@ -936,6 +935,7 @@ immModel_getLocalAppliersForCcb(IMMND_CB SaUint32T arrSize = (SaUint32T) cv.size(); if(arrSize) { + unsigned int ix = 0; *aplConnArr = (SaUint32T *) malloc((arrSize) * sizeof(SaUint32T)); for(cvi = cv.begin(); cvi!=cv.end(); ++cvi, ++ix) { @@ -1038,11 +1038,11 @@ immModel_getNonCriticalCcbs(IMMND_CB *cb { IdVector ccbs; IdVector::iterator ix2; - unsigned int ix; ImmModel::instance(&cb->immModel)->getNonCriticalCcbs(ccbs); *ccbIdArrSize = (SaUint32T) ccbs.size(); if(*ccbIdArrSize) { + unsigned int ix; *ccbIdArr = (SaUint32T *) malloc((*ccbIdArrSize) * sizeof(SaUint32T)); for(ix2=ccbs.begin(), ix=0; @@ -1071,13 +1071,13 @@ immModel_getOldCriticalCcbs(IMMND_CB *cb { IdVector ccbs; IdVector::iterator ix2; - unsigned int ix; if(ImmModel::instance(&cb->immModel)->getPbeOi(pbeConn, pbeNodeId, false)) { ImmModel::instance(&cb->immModel)->getOldCriticalCcbs(ccbs, pbeConn, pbeNodeId, pbeId); *ccbIdArrSize = (SaUint32T) ccbs.size(); if(*ccbIdArrSize) { + unsigned int ix; *ccbIdArr = (SaUint32T *) malloc((*ccbIdArrSize) * sizeof(SaUint32T)); @@ -1879,13 +1879,12 @@ immModel_discardImplementer(IMMND_CB* cb { ConnVector gv; ConnVector::iterator gvi; - unsigned int ix=0; ImmModel::instance(&cb->immModel)->discardImplementer(implId, reallyDiscard, gv, cb->mIsCoord); if (globArrSize && globccbIdArr) { *globArrSize = (SaUint32T) gv.size(); - ix=0; + unsigned int ix=0; if(*globArrSize) { *globccbIdArr = (SaUint32T *) malloc((*globArrSize)* sizeof(SaUint32T)); for(gvi = gv.begin(); gvi!=gv.end(); ++gvi, ++ix) { @@ -2028,7 +2027,6 @@ int immModel_pbePrtObjDeletesContinuatio { ObjectNameVector ov; ObjectNameVector::iterator oni; - unsigned int ix = 0; int numOps=0; osafassert(arrSizePtr); @@ -2037,6 +2035,7 @@ int immModel_pbePrtObjDeletesContinuatio (*arrSizePtr) = (SaUint32T) ov.size(); if(*arrSizePtr) { + unsigned int ix = 0; *objNameArr = (SaStringT *) malloc((*arrSizePtr)* sizeof(SaStringT)); for(oni=ov.begin(); oni != ov.end(); ++oni, ++ix) { @@ -2977,11 +2976,11 @@ ImmModel::adjustEpoch(int suggestedEpoch { int restoredEpoch = 0; ImmAttrValueMap::iterator avi; - ObjectInfo* immObject = NULL; ObjectMap::iterator oi = sObjectMap.find(immObjectDn); osafassert(oi != sObjectMap.end() && oi->second); - immObject = oi->second; + ObjectInfo* immObject = oi->second; + osafassert(immObject != nullptr); avi = immObject->mAttrValueMap.find(immAttrEpoch); osafassert(avi != immObject->mAttrValueMap.end()); osafassert(!avi->second->isMultiValued()); @@ -2999,7 +2998,7 @@ ImmModel::adjustEpoch(int suggestedEpoch } } - if(increment && immObject && avi != immObject->mAttrValueMap.end()) { + if((increment) && (avi != immObject->mAttrValueMap.end())) { avi->second->setValue_int(suggestedEpoch); LOG_NO("Epoch set to %u in ImmModel", suggestedEpoch); } @@ -4859,7 +4858,7 @@ ImmModel::attrCreate(ClassInfo* classInf struct AttrDescriptionGet { - AttrDescriptionGet(ImmsvOmClassDescr*& s) : classDescription(s) { } + explicit AttrDescriptionGet(ImmsvOmClassDescr*& s) : classDescription(s) { } AttrMap::value_type operator() (const AttrMap::value_type& item) { ImmsvAttrDefList* p = (ImmsvAttrDefList*) @@ -5459,9 +5458,7 @@ ImmModel::ccbResult(SaUint32T ccbId) bool ImmModel::validateNoDanglingRefsModify(CcbInfo* ccb, ObjectMutationMap::iterator &omit) { ClassInfo *classInfo = omit->second->mAfterImage->mClassInfo; AttrMap::iterator amit; - AttrInfo *ai; ImmAttrValueMap::iterator avit; - ImmAttrValue *av; ObjectMap::iterator omi; @@ -5473,10 +5470,10 @@ bool ImmModel::validateNoDanglingRefsMod } for(amit=classInfo->mAttrMap.begin(); amit!=classInfo->mAttrMap.end(); ++amit) { - ai = amit->second; + AttrInfo *ai = amit->second; if(ai->mFlags & SA_IMM_ATTR_NO_DANGLING) { if((avit = omit->second->mAfterImage->mAttrValueMap.find(amit->first)) != omit->second->mAfterImage->mAttrValueMap.end()) { - av = avit->second; + ImmAttrValue *av = avit->second; while(av) { /* Empty attribute */ @@ -7138,7 +7135,6 @@ ImmModel::specialApplierTrimModify(SaUin } int x=0; immsv_attr_mods_list** head = &attrMods; - immsv_attr_mods_list* current = attrMods; bool processAdmoAttr=false; /* AdminOwner attribute added for regular ccbs */ bool processImplAttr=false; /* Implementer attribute added for RTA updates (ccbId ==0) */ bool processClassAttr=true; /* Allways add class name attribute */ @@ -7151,7 +7147,7 @@ ImmModel::specialApplierTrimModify(SaUin tmp->attrValue.attrValueType = SA_IMM_ATTR_SASTRINGT; /* All other members zeroed in calloc above. */ tmp->next = attrMods; - current = attrMods = tmp; + immsv_attr_mods_list* current = attrMods = tmp; tmp = NULL; /* Prepend fake class-name attribute modification done */ @@ -7442,22 +7438,20 @@ ObjectInfo* ImmModel::getObjectAfterImageInCcb(const std::string& objName, SaUint32T ccbId) { CcbVector::iterator ci; - CcbInfo* ccb = NULL; ObjectInfo* afim = NULL; ObjectMutationMap::iterator omuti; - ObjectMutation* oMut = NULL; osafassert(!objName.empty()); /* Get ccb info */ ci = std::find_if(sCcbVector.begin(), sCcbVector.end(), CcbIdIs(ccbId)); osafassert(ci != sCcbVector.end()); - ccb = *ci; + CcbInfo* ccb = *ci; /* Get object mutation */ omuti = ccb->mMutations.find(objName); osafassert(omuti != ccb->mMutations.end()); - oMut = omuti->second; + ObjectMutation* oMut = omuti->second; /* Get after image */ if (oMut->mOpType == IMM_CREATE || oMut->mOpType == IMM_MODIFY) { @@ -7547,8 +7541,7 @@ ImmModel::canonicalizeAttrModification(c osafassert(!objectName.empty()); /* Get after image */ - afim = getObjectAfterImageInCcb(objectName, req->ccbId); - osafassert(afim); + osafassert(afim = getObjectAfterImageInCcb(objectName, req->ccbId)); /* Build canonicalized attr-mod list */ immsv_attr_mods_list* reqAttrMods = req->attrMods; @@ -7586,8 +7579,7 @@ ImmModel::getAllWritableAttributes(const osafassert(!objectName.empty()); /* Get after image */ - afim = getObjectAfterImageInCcb(objectName, req->ccbId); - osafassert(afim); + osafassert(afim = getObjectAfterImageInCcb(objectName, req->ccbId)); /* Build attr-mod list for all writable attributes */ osafassert(hasLongDn); @@ -10553,7 +10545,13 @@ ImmModel::setCcbErrorString(CcbInfo *ccb osafassert(len >= 0); len++; /* Reserve one byte for null-terminated sign '\0' */ if(len > errLen) { - fmtError = (char *)realloc(fmtError, len); + char *newFmtError = (char *)realloc(fmtError, len); + if (newFmtError == nullptr) { + TRACE_5("realloc error ,No memory "); + return; + } else { + fmtError = newFmtError; + } osafassert(vsnprintf(fmtError, len, errorString, vl) >= 0); } @@ -10795,7 +10793,7 @@ ImmModel::ccbWaitForCompletedAck(SaUint3 if(((*err) == SA_AIS_OK) && pbeNodeIdPtr) { /* There should be a PBE */ - ImplementerInfo* pbeImpl = (ImplementerInfo *) getPbeOi(pbeConnPtr, pbeNodeIdPtr); + ImplementerInfo* pbeImpl = reinterpret_cast<ImplementerInfo *> (getPbeOi(pbeConnPtr, pbeNodeIdPtr)); if(pbeImpl && !mPbeDisableCritical) { /* There is in fact a PBE (up) */ osafassert(ccb->mState == IMM_CCB_PREPARE); @@ -11024,7 +11022,7 @@ ImmModel::ccbCompletedContinuation(immsv /* Verify that it is the PBE that is replying. */ SaUint32T dummyConn; unsigned int dummyNodeId; - ImplementerInfo* pbeImpl = (ImplementerInfo *) getPbeOi(&dummyConn, &dummyNodeId); + ImplementerInfo* pbeImpl = reinterpret_cast<ImplementerInfo *> (getPbeOi(&dummyConn, &dummyNodeId)); if(!pbeImpl || (pbeImpl->mId != rsp->implId)) { LOG_WA("Received commit/abort decision on ccb %u from terminated PBE", ccbId); TRACE_LEAVE(); @@ -12507,7 +12505,7 @@ SaAisErrorT ImmModel::nextSyncResult(Imm ObjectSet::iterator *osip = (ObjectSet::iterator *) op.syncOsi; if(!osip) { return SA_AIS_ERR_NOT_EXIST;} ImmsvAttrNameList* theAttList = (ImmsvAttrNameList *) op.attrNameList; - ClassInfo* classInfo = (ClassInfo *) op.classInfo; + ClassInfo* classInfo = reinterpret_cast<ClassInfo *> (op.classInfo); osafassert(classInfo != NULL); ObjectInfo* obj = NULL; std::string objectName; @@ -13918,8 +13916,8 @@ ImmModel::getOldCriticalCcbs(IdVector& c } TRACE("CCB %u is waiting on PBE commit", ccb->mId); - ImplementerInfo* impInfo = (ImplementerInfo *) - getPbeOi(pbeConnPtr, pbeNodeIdPtr, false); + ImplementerInfo* impInfo = reinterpret_cast<ImplementerInfo *> + (getPbeOi(pbeConnPtr, pbeNodeIdPtr, false)); /* Unsafe getPbeOI OK here because getOldCriticalCcbs is only a cleanup function. It is also only executed at coord and PBE can only be colocated with coord. */ @@ -14141,11 +14139,10 @@ ImmModel::cleanTheBasement(InvocVector& i3 = sCcbVector.begin(); int terminatedCcbTime = 300, val; - ObjectInfo* immObject = NULL; ImmAttrValueMap::iterator avi; ObjectMap::iterator oi = sObjectMap.find(immObjectDn); osafassert(oi != sObjectMap.end() && oi->second); - immObject = oi->second; + ObjectInfo* immObject = oi->second; avi = immObject->mAttrValueMap.find(immMaxCcbs); @@ -16542,11 +16539,11 @@ SaInt32T ImmModel::pbePrtObjDeletesConti unsigned int slaveNodeId=0; unsigned int nrofDeletes=0; bool deleteRootFound=false; - bool sendCompletedToSlave=false; SaInvocationT inv = m_IMMSV_PACK_HANDLE(invocation, nodeId); ObjectMutationMap::iterator i2 = sPbeRtMutations.begin(); if(getPbeBSlave(pbe2BConnPtr, &slaveNodeId)) { + bool sendCompletedToSlave=false; /* slave exists check if reply was from primary or slave.*/ for(;i2!=sPbeRtMutations.end(); ++i2) { if(i2->second->mContinuationId != invocation) { @@ -19360,7 +19357,6 @@ ImmModel::isolateThisNode(unsigned int t */ ImplementerVector::iterator i; AdminOwnerVector::iterator i2; - CcbVector::iterator i3; unsigned int otherNode; if((sImmNodeState != IMM_NODE_FULLY_AVAILABLE) && (sImmNodeState != IMM_NODE_R_AVAILABLE)) { diff --git a/src/imm/immnd/immnd_clm.c b/src/imm/immnd/immnd_clm.c --- a/src/imm/immnd/immnd_clm.c +++ b/src/imm/immnd/immnd_clm.c @@ -162,11 +162,9 @@ static const SaClmCallbacksT_4 clm_callb ****************************************************************************/ void immnd_init_with_clm(void) { - SaAisErrorT rc = SA_AIS_OK; - TRACE_ENTER(); - rc = saClmInitialize_4(&immnd_cb->clm_hdl, &clm_callbacks, &clmVersion); + SaAisErrorT rc = saClmInitialize_4(&immnd_cb->clm_hdl, &clm_callbacks, &clmVersion); while ((rc == SA_AIS_ERR_TRY_AGAIN) || (rc == SA_AIS_ERR_TIMEOUT) || (rc == SA_AIS_ERR_UNAVAILABLE)) { osaf_nanosleep(&kHundredMilliseconds); diff --git a/src/imm/immnd/immnd_db.c b/src/imm/immnd/immnd_db.c --- a/src/imm/immnd/immnd_db.c +++ b/src/imm/immnd/immnd_db.c @@ -82,11 +82,9 @@ void immnd_client_node_getnext(IMMND_CB *****************************************************************************/ uint32_t immnd_client_node_add(IMMND_CB *cb, IMMND_IMM_CLIENT_NODE *cl_node) { - uint32_t rc = NCSCC_RC_FAILURE; - cl_node->patnode.key_info = (uint8_t *)&cl_node->imm_app_hdl; - rc = ncs_patricia_tree_add(&cb->client_info_db, (NCS_PATRICIA_NODE *)&cl_node->patnode); + uint32_t rc = ncs_patricia_tree_add(&cb->client_info_db, (NCS_PATRICIA_NODE *)&cl_node->patnode); return rc; } @@ -104,9 +102,8 @@ uint32_t immnd_client_node_add(IMMND_CB *****************************************************************************/ uint32_t immnd_client_node_del(IMMND_CB *cb, IMMND_IMM_CLIENT_NODE *imm_client_node) { - uint32_t rc = NCSCC_RC_FAILURE; - rc = ncs_patricia_tree_del(&cb->client_info_db, (NCS_PATRICIA_NODE *)&imm_client_node->patnode); + uint32_t rc = ncs_patricia_tree_del(&cb->client_info_db, (NCS_PATRICIA_NODE *)&imm_client_node->patnode); return rc; } diff --git a/src/imm/immnd/immnd_evt.c b/src/imm/immnd/immnd_evt.c --- a/src/imm/immnd/immnd_evt.c +++ b/src/imm/immnd/immnd_evt.c @@ -1037,8 +1037,7 @@ void search_req_continue(IMMND_CB *cb, I osafassert(reply->requestNodeId == cb->node_id); memset(&send_evt, '\0', sizeof(IMMSV_EVT)); send_evt.type = IMMSV_EVT_TYPE_IMMA; - SaImmHandleT tmp_hdl = 0LL; - tmp_hdl = m_IMMSV_PACK_HANDLE(reqConn, cb->node_id); + SaImmHandleT tmp_hdl = m_IMMSV_PACK_HANDLE(reqConn, cb->node_id); /*Look up client-node */ immnd_client_node_get(cb, tmp_hdl, &cl_node); @@ -1378,14 +1377,13 @@ static uint32_t immnd_evt_proc_oi_att_pu void freeSearchNext(IMMSV_OM_RSP_SEARCH_NEXT *rsp, bool freeTop) { - IMMSV_ATTR_VALUES_LIST *al = NULL; TRACE_ENTER(); TRACE_2("objectName:%s", rsp->objectName.buf); free(rsp->objectName.buf); rsp->objectName.buf = NULL; - al = rsp->attrValuesList; + IMMSV_ATTR_VALUES_LIST *al = rsp->attrValuesList; while (al) { free(al->n.attrName.buf); al->n.attrName.buf = NULL; @@ -4469,10 +4467,9 @@ static void immnd_evt_safe_read_lock(IMM { IMMSV_EVT send_evt; IMMND_IMM_CLIENT_NODE *cl_node = NULL; - SaAisErrorT err = SA_AIS_OK; TRACE_ENTER(); - err = immModel_objectIsLockedByCcb(cb, &(evt->info.searchInit)); + SaAisErrorT err = immModel_objectIsLockedByCcb(cb, &(evt->info.searchInit)); switch (err) { case SA_AIS_OK: @@ -5123,7 +5120,6 @@ static void immnd_evt_proc_admop(IMMND_C SaUint32T implConn = 0; NCS_NODE_ID implNodeId = 0; - bool async = false; /*displayRes is used for admin-operation which has OperationName as display and directed towards opensafImm=opensafImm,safApp=safImmService object. SA_AIS_ERR_REPAIR_PENDING will be returned if there is no PBE and OperationName is display. @@ -5131,7 +5127,7 @@ static void immnd_evt_proc_admop(IMMND_C bool displayRes=false; bool pbeExpected = cb->mPbeFile && (cb->mRim == SA_IMM_KEEP_REPOSITORY); - async = (evt->type == IMMND_EVT_A2ND_IMM_ADMOP_ASYNC); + bool async = (evt->type == IMMND_EVT_A2ND_IMM_ADMOP_ASYNC); osafassert(evt->type == IMMND_EVT_A2ND_IMM_ADMOP || async); TRACE_ENTER(); TRACE_1(async ? "ASYNC ADMOP" : "SYNC ADMOP"); @@ -5489,7 +5485,6 @@ static void immnd_evt_proc_class_create( /* See comment **** above. */ } } - implHandle = 0LL; pbe_cl_node = NULL; } } @@ -5635,7 +5630,6 @@ static void immnd_evt_proc_class_delete( /* See comment **** above. */ } } - implHandle = 0LL; pbe_cl_node = NULL; } } @@ -6239,7 +6233,6 @@ static void immnd_evt_proc_object_create if (!osaf_is_extended_name_empty(&objName) && (err == SA_AIS_OK)) { /* Generate applier upcalls for the object create */ SaUint32T *applConnArr = NULL; - int ix = 0; SaUint32T arrSize = immModel_getLocalAppliersForObj(cb, &objName, evt->info.objCreate.ccbId, &applConnArr, false); @@ -6253,7 +6246,7 @@ static void immnd_evt_proc_object_create send_evt.info.imma.info.objCreate.adminOwnerId = 0; /* Re-use the adminOwner member of the ccbCreate message to hold the invocation id. In this case, 0 => no reply is expected. */ - + int ix = 0; for (; ix < arrSize && err == SA_AIS_OK; ++ix) { implHandle = m_IMMSV_PACK_HANDLE(applConnArr[ix], cb->node_id); send_evt.info.imma.info.objCreate.immHandle = implHandle; @@ -6505,7 +6498,6 @@ static void immnd_evt_proc_object_modify if (!osaf_is_extended_name_empty(&objName) && (err == SA_AIS_OK)) { /* Generate applier upcalls for the object modify */ SaUint32T *applConnArr = NULL; - int ix = 0; SaUint32T arrSize = immModel_getLocalAppliersForObj(cb, &objName, evt->info.objModify.ccbId, &applConnArr, false); @@ -6518,7 +6510,7 @@ static void immnd_evt_proc_object_modify send_evt.info.imma.info.objModify.adminOwnerId = 0; /* Re-use the adminOwner member of the ccbModify message to hold the invocation id. In this case, 0 => no reply is expected. */ - + int ix = 0; for (; ix < arrSize && err == SA_AIS_OK; ++ix) { bool isSpecialApplier = false; send_evt.info.imma.info.objModify.attrMods = evt->info.objModify.attrMods; @@ -7765,7 +7757,7 @@ static void immnd_evt_proc_ccb_finalize( free(clientArr); immsv_evt_free_attrNames(errStrings); err = immModel_ccbFinalize(cb, evt->info.ccbId); - TRACE_LEAVE(); + TRACE_LEAVE2("err:%d",err); } /**************************************************************************** @@ -8945,9 +8937,9 @@ static uint32_t immnd_evt_proc_intro_rsp } if(cb->m2Pbe && cb->mCanBeCoord) { - char pbeFileSuffix[64]; const char* pbe_file_suffix = getenv("IMMSV_PBE_FILE_SUFFIX"); if(!pbe_file_suffix) { + char pbeFileSuffix[64]; snprintf(pbeFileSuffix, 64, ".%x", cb->node_id); osafassert(setenv("IMMSV_PBE_FILE_SUFFIX", pbeFileSuffix, 0)==0); } @@ -10319,14 +10311,13 @@ void immnd_evt_ccb_augment_init(IMMND_CB uint32_t rc = NCSCC_RC_SUCCESS; IMMSV_EVT send_evt; IMMND_IMM_CLIENT_NODE *cl_node = NULL; - SaAisErrorT err = SA_AIS_OK; NCS_NODE_ID nodeId = m_IMMSV_UNPACK_HANDLE_LOW(clnt_hdl); SaUint32T conn = m_IMMSV_UNPACK_HANDLE_HIGH(clnt_hdl); osafassert(evt); SaUint32T adminOwnerId = 0; TRACE_ENTER(); - err = immModel_ccbAugmentInit(cb, &(evt->info.ccbUpcallRsp), nodeId, + SaAisErrorT err = immModel_ccbAugmentInit(cb, &(evt->info.ccbUpcallRsp), nodeId, (originatedAtThisNd) ? conn : 0, &adminOwnerId); if (originatedAtThisNd) { /*Send reply to client from this ND. */ @@ -10487,7 +10478,7 @@ static uint32_t immnd_evt_proc_mds_evt(I LOG_WA("IMMND re-introduceMe after IMMD restart failed, will retry"); } } else if ((evt->info.mds_info.change == NCSMDS_UP) && - (evt->info.mds_info.svc_id == NCSMDS_SVC_ID_IMMA_OM || + (evt->info.mds_info.svc_id == NCSMDS_SVC_ID_IMMA_OI || evt->info.mds_info.svc_id == NCSMDS_SVC_ID_IMMA_OM)) { TRACE_2("IMMA UP EVENT"); } else if ((evt->info.mds_info.change == NCSMDS_RED_UP) && diff --git a/src/imm/immnd/immnd_main.c b/src/imm/immnd/immnd_main.c --- a/src/imm/immnd/immnd_main.c +++ b/src/imm/immnd/immnd_main.c @@ -82,9 +82,7 @@ static void sigusr1_handler(int sig) *****************************************************************************/ static uint32_t immnd_cb_db_init(IMMND_CB *cb) { - uint32_t rc = NCSCC_RC_SUCCESS; - - rc = immnd_client_node_tree_init(cb); + uint32_t rc = immnd_client_node_tree_init(cb); if (rc == NCSCC_RC_FAILURE) LOG_ER("client node tree init failed"); diff --git a/src/imm/immnd/immnd_mds.c b/src/imm/immnd/immnd_mds.c --- a/src/imm/immnd/immnd_mds.c +++ b/src/imm/immnd/immnd_mds.c @@ -121,14 +121,13 @@ uint32_t immnd_mds_get_handle(IMMND_CB * uint32_t immnd_mds_register(IMMND_CB *cb) { - uint32_t rc = NCSCC_RC_SUCCESS; NCSMDS_INFO svc_info; MDS_SVC_ID svc_id[1] = { NCSMDS_SVC_ID_IMMD }; /*NCS_PHY_SLOT_ID phy_slot; */ TRACE_ENTER(); /* STEP1: Get the MDS Handle */ - rc = immnd_mds_get_handle(cb); + uint32_t rc = immnd_mds_get_handle(cb); if (rc != NCSCC_RC_SUCCESS) return rc; @@ -323,8 +322,6 @@ uint32_t immnd_mds_callback(struct ncsmd ******************************************************************************/ static uint32_t immnd_mds_enc(IMMND_CB *cb, MDS_CALLBACK_ENC_INFO *enc_info) { - IMMSV_EVT *evt; - /* Get the Msg Format version from the SERVICE_ID & RMT_SVC_PVT_SUBPART_VERSION */ if (enc_info->i_to_svc_id == NCSMDS_SVC_ID_IMMA_OM) { @@ -359,7 +356,7 @@ static uint32_t immnd_mds_enc(IMMND_CB * } if (1 /*enc_info->o_msg_fmt_ver */ ) { /*TODO: ABT Does not work */ - evt = (IMMSV_EVT *)enc_info->i_msg; + IMMSV_EVT *evt = (IMMSV_EVT *)enc_info->i_msg; return immsv_evt_enc( /*&cb->immnd_edu_hdl, */ evt, enc_info->io_uba); } @@ -419,7 +416,6 @@ static uint32_t immnd_mds_dec(IMMND_CB * ******************************************************************************/ static uint32_t immnd_mds_enc_flat(IMMND_CB *cb, MDS_CALLBACK_ENC_FLAT_INFO *info) { - IMMSV_EVT *evt; uint32_t rc = NCSCC_RC_SUCCESS; NCS_UBAID *uba = info->io_uba; @@ -458,7 +454,7 @@ static uint32_t immnd_mds_enc_flat(IMMND } if (1 /*info->o_msg_fmt_ver */ ) { /* TODO: ABT Does not work */ - evt = (IMMSV_EVT *)info->i_msg; + IMMSV_EVT *evt = (IMMSV_EVT *)info->i_msg; rc = immsv_evt_enc_flat( /*&cb->immnd_edu_hdl, */ evt, uba); if (rc != NCSCC_RC_SUCCESS) { LOG_WA("MDS Encode Flat Failed"); diff --git a/src/imm/immnd/immnd_proc.c b/src/imm/immnd/immnd_proc.c --- a/src/imm/immnd/immnd_proc.c +++ b/src/imm/immnd/immnd_proc.c @@ -745,13 +745,11 @@ void immnd_adjustEpoch(IMMND_CB *cb, boo if(pbeNodeId && pbeConn) { IMMND_IMM_CLIENT_NODE *pbe_cl_node = NULL; - SaImmOiHandleT implHandle = 0LL; - /*The persistent back-end is executing at THIS node. */ osafassert(cb->mIsCoord); osafassert(pbeNodeId == cb->node_id); - implHandle = m_IMMSV_PACK_HANDLE(pbeConn, pbeNodeId); + SaImmOiHandleT implHandle = m_IMMSV_PACK_HANDLE(pbeConn, pbeNodeId); /*Fetch client node for PBE */ immnd_client_node_get(cb, implHandle, &pbe_cl_node); @@ -1154,7 +1152,6 @@ static void immnd_cleanTheHouse(IMMND_CB */ NCS_NODE_ID pbeNodeId = 0; SaUint32T pbeId = 0; - int ix; SaUint32T *ccbIdArr = NULL; SaUint32T ccbIdArrSize = 0; immModel_getOldCriticalCcbs(cb, &ccbIdArr, &ccbIdArrSize, @@ -1175,7 +1172,7 @@ static void immnd_cleanTheHouse(IMMND_CB immnd_client_node_get(cb, implHandle, &oi_cl_node); osafassert(oi_cl_node); osafassert(!(oi_cl_node->mIsStale)); - for (ix = 0; ix < ccbIdArrSize; ++ix) { + for (int ix = 0; ix < ccbIdArrSize; ++ix) { TRACE_2("Fetch ccb outcome for ccb%u, nodeId:%u, conn:%u implId:%u", ccbIdArr[ix], pbeNodeId, pbeConn, pbeId); /* Generate a IMMA_EVT_ND2A_OI_CCB_COMPLETED_UC towards pbeOi ------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
