-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code optimizations reported by static code analysis (2020-02-18) #38141
Conversation
As a matter of personal interest and education, what are we using for static code analysis? Is it |
PVS Studio, ReSharper C++ |
Oh, I've heard good things about ReSharper, but didn't realise it did C++ as well as C#. Thank you, @ZhilkinSerg ! |
src/activity_item_handling.cpp
Outdated
items_there.erase( item_iter ); | ||
// If we didn't pick up a whole stack, put the remainder back where it came from. | ||
if( leftovers.charges > 0 ) { | ||
g->m.add_item_or_charges( src_loc, leftovers ); | ||
} | ||
std::string picked_up = it.tname(); | ||
if( p.is_npc() && !picked_up.empty() ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Under what circumstance would item::tname
return an empty string? It seems this check will never be false.
* Revert "Moved more string consts into single file (#38237)" This reverts commit 4987742. * Revert "Moved more string consts into single file (#38220)" This reverts commit d9c6079. * Revert "Move string consts into single file (#38195)" This reverts commit b1b48ba. * Revert "More string consts into single file (#38189)" This reverts commit 4fffd96. * Revert "More string consts into single file (#38183)" This reverts commit 05940bf. * Revert "Move string consts into single file (#38184)" This reverts commit 19c5698. * Revert "Move string consts into single file (#38181)" This reverts commit 55cabb7. * Revert "Move more string consts into single file (#38175)" This reverts commit 571efb2. * Revert "Merge pull request #38176 from Ramza13/string_consts_and_more" This reverts commit 9c9835f, reversing changes made to 07995cd. * Revert "Move more string consts into single file (#38169)" This reverts commit 07995cd. * Revert "Merge pull request #38168 from Ramza13/even_more_string_consts" This reverts commit 2bf1c1e, reversing changes made to 24a32c0. * Revert "Merge pull request #38141 from ZhilkinSerg/sa-2020-02-18" This reverts commit 142295b, reversing changes made to f98c67d. * Revert "Move string consts into single file (#38158)" This reverts commit 50059c8. * Revert "Merge pull request #38157 from Ramza13/string_consts_more_flags" This reverts commit 8ec8e78, reversing changes made to 72ef022. * Revert "Move string_consts" This reverts commit 0a6bf67. * Revert "Merge pull request #38146 from Ramza13/battery" This reverts commit 9286722, reversing changes made to e9f1cd7. * Revert "Merge pull request #38134 from AMurkin/rename-blob" This reverts commit 06f72d2, reversing changes made to bcfe074. * Revert "Yet more string consts moved out (#38130)" This reverts commit b5f18f3. * Revert "Merge pull request #38115 from Ramza13/string_consts_game" This reverts commit 9807657, reversing changes made to 036465f. * Fixup to the picked_up * RE-inline item_location initialization * Update character.h * Update item.cpp * Update item.h * Update item_action.cpp * Update item_factory.cpp * Update point.h * Update safemode_ui.cpp
Summary
SUMMARY: Performance "Code optimizations reported by static code analysis"
Purpose of change
Cleanup code.
Describe the solution
See commit messages.