Index: snapshot/mac/mach_o_image_segment_reader.cc |
diff --git a/snapshot/mac/mach_o_image_segment_reader.cc b/snapshot/mac/mach_o_image_segment_reader.cc |
index 6adcd6f2ef56a36da7949730793fec6197ccd554..8a077ddec036410e5ec373eb024c416712281d54 100644 |
--- a/snapshot/mac/mach_o_image_segment_reader.cc |
+++ b/snapshot/mac/mach_o_image_segment_reader.cc |
@@ -16,6 +16,8 @@ |
#include <mach-o/loader.h> |
+#include <utility> |
+ |
#include "base/logging.h" |
#include "base/strings/stringprintf.h" |
#include "snapshot/mac/process_reader.h" |
@@ -185,14 +187,14 @@ bool MachOImageSegmentReader::Initialize(ProcessReader* process_reader, |
return false; |
} |
- const auto& iterator = section_map_.find(section_name); |
- if (iterator != section_map_.end()) { |
+ const auto insert_result = |
+ section_map_.insert(std::make_pair(section_name, section_index)); |
+ if (!insert_result.second) { |
LOG(WARNING) << base::StringPrintf("duplicate section name at %zu", |
- iterator->second) << section_info; |
+ insert_result.first->second) |
+ << section_info; |
return false; |
} |
- |
- section_map_[section_name] = section_index; |
} |
INITIALIZATION_STATE_SET_VALID(initialized_); |