Index: snapshot/mac/mach_o_image_symbol_table_reader.cc |
diff --git a/snapshot/mac/mach_o_image_symbol_table_reader.cc b/snapshot/mac/mach_o_image_symbol_table_reader.cc |
index 12d8de7e2b718b6d2ce9ed4f46f0f8c00b4ebbc7..949e46088697241c5eebc77ab35199d9f9e13fd1 100644 |
--- a/snapshot/mac/mach_o_image_symbol_table_reader.cc |
+++ b/snapshot/mac/mach_o_image_symbol_table_reader.cc |
@@ -17,6 +17,8 @@ |
#include <mach-o/loader.h> |
#include <mach-o/nlist.h> |
+#include <utility> |
+ |
#include "base/memory/scoped_ptr.h" |
#include "base/strings/stringprintf.h" |
#include "util/mac/checked_mach_address_range.h" |
@@ -153,15 +155,14 @@ class MachOImageSymbolTableReaderInitializer { |
return false; |
} |
- if (external_defined_symbols->count(name)) { |
- LOG(WARNING) << "duplicate symbol " << name << symbol_info; |
- return false; |
- } |
- |
MachOImageSymbolTableReader::SymbolInformation this_symbol_info; |
this_symbol_info.value = symbol.n_value; |
this_symbol_info.section = symbol.n_sect; |
- (*external_defined_symbols)[name] = this_symbol_info; |
+ if (!external_defined_symbols->insert( |
+ std::make_pair(name, this_symbol_info)).second) { |
+ LOG(WARNING) << "duplicate symbol " << name << symbol_info; |
+ return false; |
+ } |
} else { |
// External indirect symbols may be found in the portion of the symbol |
// table used for external symbols as opposed to indirect symbols when |