Summary:imm: Fix all Cppcheck 1.77 issues [#2333] Review request for Trac Ticket(s): #2333 Peer Reviewer(s): Zoran, Hung , Neel Pull request to: Affected branch(es): default, 5.2 Development branch: default
-------------------------------- Impacted area Impact y/n -------------------------------- Docs n Build system n RPM/packaging n Configuration files n Startup scripts n SAF services n OpenSAF services y Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): --------------------------------------------- <<EXPLAIN/COMMENT THE PATCH SERIES HERE>> changeset 7128c745cb562946d2beb92d0f644f69e52cd4ef Author: A V Mahesh <[email protected]> Date: Fri, 03 Mar 2017 11:07:40 +0530 imm: Fix all Cppcheck 1.77 issues [#2333] 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]: Complete diffstat: ------------------ 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(-) Testing Commands: ----------------- Imm functionality should work as it is Testing, Expected Results: -------------------------- Conditions of Submission: ------------------------- <<HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC>> Arch Built Started Linux distro ------------------------------------------- mips n n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: ------------------- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.hgrc file (i.e. username, email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
