Index: tools/mac/run_with_crashpad.cc |
diff --git a/tools/mac/run_with_crashpad.cc b/tools/mac/run_with_crashpad.cc |
index 9d6679cff22380ebf26bc2e672f454de14743ab1..0b4653aa20caf9314dfc9390d90a91d35ea9e9f3 100644 |
--- a/tools/mac/run_with_crashpad.cc |
+++ b/tools/mac/run_with_crashpad.cc |
@@ -27,6 +27,7 @@ |
#include "base/logging.h" |
#include "client/crashpad_client.h" |
#include "tools/tool_support.h" |
+#include "util/stdlib/map_insert.h" |
#include "util/string/split_string.h" |
namespace crashpad { |
@@ -118,13 +119,10 @@ int RunWithCrashpadMain(int argc, char* argv[]) { |
ToolSupport::UsageHint(me, "--annotation requires KEY=VALUE"); |
return EXIT_FAILURE; |
} |
- auto it = options.annotations.find(key); |
- if (it != options.annotations.end()) { |
+ std::string old_value; |
+ if (!MapInsertOrReplace(&options.annotations, key, value, &old_value)) { |
LOG(WARNING) << "duplicate key " << key << ", discarding value " |
- << it->second; |
- it->second = value; |
- } else { |
- options.annotations.insert(std::make_pair(key, value)); |
+ << old_value; |
} |
break; |
} |