Summary:log: Fix all Cppcheck 1.77 issues [#2326] Review request for Trac Ticket(s): #2326 Peer Reviewer(s): Lennart, Canh, Vu Pull request to: <<LIST THE PERSON WITH PUSH ACCESS HERE>> Affected branch(es):default 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): --------------------------------------------- changeset 706805aa49e964272b54b834aeb1e8d7796a7ebc Author: A V Mahesh <[email protected]> Date: Tue, 28 Feb 2017 11:18:05 +0530 log: Fix all Cppcheck 1.77 issues [#2326] Except never used functions all other issues are fixed of below, some UN- pushed enhancement may be using those functions. ============================================================================ [staging/src/log/logd/lgs_config.h:90]: (performance) Function parameter param_name should be passed by reference. [staging/src/log/logd/lgs_config.h:230]: (performance) Function parameter attribute_name should be passed by reference. [staging/src/log/logd/lgs_config.h:231]: (performance) Function parameter value_list should be passed by reference. [staging/src/log/logd/lgs_config.h:238]: (performance) Function parameter attribute_name should be passed by reference. [staging/src/log/logd/lgs_config.h:239]: (performance) Function parameter value_list should be passed by reference. [staging/src/log/logd/lgs_clm.cc:137]: (style) The scope of the variable clm_node can be reduced. [staging/src/log/logd/lgs_clm.cc:220]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/log/logd/lgs_config.cc:401] -> [staging/src/log/logd/lgs_config.cc:498]: (warning) Either the condition allocmem_ptr!=NULL is redundant or there is possible null pointer dereference: param_ptr. [staging/src/log/logd/lgs_config.cc:410] -> [staging/src/log/logd/lgs_config.cc:498]: (warning) Either the condition allocmem_ptr!=NULL is redundant or there is possible null pointer dereference: param_ptr. [staging/src/log/logd/lgs_config.cc:184] -> [staging/src/log/logd/lgs_config.cc:190]: (style) Variable cfg_param_str is reassigned a value before the old one has been used. [staging/src/log/logd/lgs_config.cc:183]: (style) The scope of the variable prev_size can be reduced. [staging/src/log/logd/lgs_config.cc:727]: (style) The scope of the variable nl_cnt can be reduced. [staging/src/log/logd/lgs_config.cc:995]: (style) The scope of the variable value_string can be reduced. [staging/src/log/logd/lgs_config.cc:1034]: (style) The scope of the variable n can be reduced. [staging/src/log/logd/lgs_config.cc:142]: (warning) Member variable _lgs_conf_t::chkp_file_close_time is not initialized in the constructor. [staging/src/log/logd/lgs_config.cc:293]: (performance) Function parameter attribute_name should be passed by reference. [staging/src/log/logd/lgs_config.cc:294]: (performance) Function parameter value_list should be passed by reference. [staging/src/log/logd/lgs_config.cc:324]: (performance) Function parameter attribute_name should be passed by reference. [staging/src/log/logd/lgs_config.cc:325]: (performance) Function parameter value_list should be passed by reference. [staging/src/log/logd/lgs_evt.cc:531] -> [staging/src/log/logd/lgs_evt.cc:536]: (style) Variable lga_down_rec is reassigned a value before the old one has been used. [staging/src/log/logd/lgs_evt.cc:416]: (style) The scope of the variable ckpt_ptr can be reduced. [staging/src/log/logd/lgs_evt.cc:553]: (style) The scope of the variable stream can be reduced. [staging/src/log/logd/lgs_evt.cc:163]: (error) Mismatching allocation and deallocation: client [staging/src/log/logd/lgs_evt.cc:168]: (error) Mismatching allocation and deallocation: client [staging/src/log/logd/lgs_evt.cc:344]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/log/logd/lgs_filehdl.cc:542]: (style) Variable len is assigned a value that is never used. [staging/src/log/logd/lgs_fmt.cc:560]: (style) The scope of the variable no_ch can be reduced. [staging/src/log/logd/lgs_imm.cc:3478] -> [staging/src/log/logd/lgs_imm.cc:3479]: (warning) Either the condition attribute!=NULL is redundant or there is possible null pointer dereference: attribute. [staging/src/log/logd/lgs_imm.cc:963]: (style) The scope of the variable i can be reduced. [staging/src/log/logd/lgs_imm.cc:1885]: (style) The scope of the variable current_time can be reduced. [staging/src/log/logd/lgs_imm.cc:1924]: (style) The scope of the variable stream can be reduced. [staging/src/log/logd/lgs_imm.cc:3264]: (style) The scope of the variable name_str can be reduced. [staging/src/log/logd/lgs_imm.cc:3474]: (style) The scope of the variable value can be reduced. [staging/src/log/logd/lgs_imm_gcfg.cc:857] -> [staging/src/log/logd/lgs_imm_gcfg.cc:859]: (style) Variable rc is reassigned a value before the old one has been used. [staging/src/log/logd/lgs_imm_gcfg.cc:532]: (style) The scope of the variable name_len can be reduced. [staging/src/log/logd/lgs_imm_gcfg.cc:940]: (style) The scope of the variable rc can be reduced. [staging/src/log/logd/lgs_main.cc:319]: (style) Suspicious condition (assignment + comparison); Clarify expression with parentheses. [staging/src/log/logd/lgs_mbcsv.cc:214]: (style) Suspicious condition (assignment + comparison); Clarify expression with parentheses. [staging/src/log/logd/lgs_mbcsv.cc:541] -> [staging/src/log/logd/lgs_mbcsv.cc:551]: (style) Variable rc is reassigned a value before the old one has been used. [staging/src/log/logd/lgs_mbcsv.cc:695] -> [staging/src/log/logd/lgs_mbcsv.cc:702]: (style) Variable pheader is reassigned a value before the old one has been used. [staging/src/log/logd/lgs_mbcsv.cc:938] -> [staging/src/log/logd/lgs_mbcsv.cc:941]: (style) Variable rc is reassigned a value before the old one has been used. [staging/src/log/logd/lgs_mbcsv.cc:1125] -> [staging/src/log/logd/lgs_mbcsv.cc:1148]: (style) Variable rc is reassigned a value before the old one has been used. [staging/src/log/logd/lgs_mbcsv.cc:1875]: (style) Checking if unsigned variable clientId is less than zero. [staging/src/log/logd/lgs_mbcsv.cc:711]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/log/logd/lgs_mds.cc:1003] -> [staging/src/log/logd/lgs_mds.cc:1009]: (style) Variable rc is reassigned a value before the old one has been used. [staging/src/log/logd/lgs_stream.cc:416]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [staging/src/log/logd/lgs_stream.cc:665] -> [staging/src/log/logd/lgs_stream.cc:669]: (style) Variable stream is reassigned a value before the old one has been used. [staging/src/log/logd/lgs_stream.cc:1337]: (style) Unsigned variable id cant be negative so it is unnecessary to test it. [staging/src/log/logd/lgs_util.cc:363]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/log/logd/lgs_util.cc:912]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/log/logd/lgs_config.cc:1854]: (style) The function lgs_cfg_read_trace is never used. [staging/src/log/logd/lgs_util.cc:521]: (style) The function lgs_check_path_exists_h is never used. [staging/src/log/logd/lgs_imm.cc:3234]: (style) The function lgs_delete_one_stream_object is never used. [staging/src/log/logd/lgs_stream.cc:408]: (style) The function log_free_stream_resources is never used. [staging/src/log/logd/lgs_stream.cc:1447]: (style) The function log_stream_id_print is never used. [staging/src/log/logd/lgs_config.cc:1513]: (style) The function update_multival_rattr is never used. (information) Cppcheck cannot find all the include files (use --check-config for details) [staging/src/log/agent/lga_api.c:1104] -> [staging/src/log/agent/lga_api.c:1106]: (style) Variable logSvcUsrChars is reassigned a value before the old one has been used. [staging/src/log/agent/lga_mds.c:1408] -> [staging/src/log/agent/lga_mds.c:1428]: (style) Variable rc is reassigned a value before the old one has been used. [staging/src/log/agent/lga_mds.c:1219]: (style) The scope of the variable rc can be reduced. [staging/src/log/agent/lga_state.c:412] -> [staging/src/log/agent/lga_state.c:421]: (style) Variable ncs_rc is reassigned a value before the old one has been used. [staging/src/log/agent/lga_util.c:312] -> [staging/src/log/agent/lga_util.c:317]: (style) Variable client_hdl is reassigned a value before the old one has been used. [staging/src/log/agent/lga_util.c:416]: (style) The function lga_force_shutdown is never used. [staging/src/log/agent/lga_util.c:890]: (style) The function logtrace_init_constructor is never used. [staging/src/log/agent/lga_api.c:419]: (style) The function saLogDispatch is never used. [staging/src/log/agent/lga_api.c:538]: (style) The function saLogFinalize is never used. [staging/src/log/agent/lga_api.c:165]: (style) The function saLogInitialize is never used. [staging/src/log/agent/lga_api.c:1529]: (style) The function saLogLimitGet is never used. [staging/src/log/agent/lga_api.c:351]: (style) The function saLogSelectionObjectGet is never used. [staging/src/log/agent/lga_api.c:1373]: (style) The function saLogStreamClose is never used. [staging/src/log/agent/lga_api.c:1026]: (style) The function saLogStreamOpenAsync_2 is never used. [staging/src/log/agent/lga_api.c:798]: (style) The function saLogStreamOpen_2 is never used. [staging/src/log/agent/lga_api.c:1164]: (style) The function saLogWriteLog is never used. [staging/src/log/agent/lga_api.c:1180]: (style) The function saLogWriteLogAsync is never used. ============================================================================ Complete diffstat: ------------------ src/log/agent/lga_api.c | 3 +-- src/log/agent/lga_mds.c | 6 ++---- src/log/agent/lga_state.c | 3 +-- src/log/agent/lga_util.c | 4 +--- src/log/logd/lgs_clm.cc | 8 +++----- src/log/logd/lgs_config.cc | 33 ++++++++++++++++----------------- src/log/logd/lgs_config.h | 10 +++++----- src/log/logd/lgs_evt.cc | 17 +++++++---------- src/log/logd/lgs_filehdl.cc | 4 ---- src/log/logd/lgs_fmt.cc | 3 +-- src/log/logd/lgs_imm.cc | 25 ++++++++++++------------- src/log/logd/lgs_imm_gcfg.cc | 21 +++++++-------------- src/log/logd/lgs_main.cc | 2 +- src/log/logd/lgs_mbcsv.cc | 18 +++++++----------- src/log/logd/lgs_mds.cc | 3 +-- src/log/logd/lgs_stream.cc | 6 ++---- src/log/logd/lgs_util.cc | 10 ++++------ 17 files changed, 71 insertions(+), 105 deletions(-) Testing Commands: ----------------- Log service functionality should work as it is . Testing, Expected Results: -------------------------- <<PASTE COMMAND OUTPUTS / TEST 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
