From bb8bce932e288189202bd8d080db0cd88c0f6d70 Mon Sep 17 00:00:00 2001 From: Mikhail Lappo Date: Thu, 23 Mar 2017 17:16:17 +0100 Subject: Redundant checking of STL container element As of C++ specification size_type erase( const key_type& key ); removes the element (if one exists). There is no need to perform the check twice. Change-Id: I4b057c08526abc7c2a483a60f9e166e4d8f56a74 --- updater/blockimg.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp index efdfec19a..12ca151a1 100644 --- a/updater/blockimg.cpp +++ b/updater/blockimg.cpp @@ -1220,9 +1220,7 @@ static int PerformCommandFree(CommandParameters& params) { const std::string& id = params.tokens[params.cpos++]; - if (stash_map.find(id) != stash_map.end()) { - stash_map.erase(id); - } + stash_map.erase(id); if (params.createdstash || params.canwrite) { return FreeStash(params.stashbase, id); -- cgit v1.2.3