summaryrefslogtreecommitdiffstats
path: root/src/build_log.cc
diff options
context:
space:
mode:
authorEvan Jones <ej@evanjones.ca>2012-01-13 14:20:07 (GMT)
committerEvan Jones <ej@evanjones.ca>2012-01-13 14:20:07 (GMT)
commitec18376c7b6b1be44ad4c2055e0ee80aa711b884 (patch)
treefbe5e0a64436660c5f14abe4e6841a29ec6db6ec /src/build_log.cc
parent9017c5b46b1a865db58a9f29ce4bca79c9feb15a (diff)
downloadNinja-ec18376c7b6b1be44ad4c2055e0ee80aa711b884.zip
Ninja-ec18376c7b6b1be44ad4c2055e0ee80aa711b884.tar.gz
Ninja-ec18376c7b6b1be44ad4c2055e0ee80aa711b884.tar.bz2
BuildLog: Use Log::insert(Log::value_type()) to avoid invalid strings.
The MSVC std::string implementation copies strings, so using make_pair resulted in a pointer to invalid memory. This ensures the insert uses a StringPiece without an intermediate std::string copy, so the correct pointer ends up in the hash_map.
Diffstat (limited to 'src/build_log.cc')
-rw-r--r--src/build_log.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/build_log.cc b/src/build_log.cc
index f342e83..4c875d9 100644
--- a/src/build_log.cc
+++ b/src/build_log.cc
@@ -85,7 +85,7 @@ void BuildLog::RecordCommand(Edge* edge, int start_time, int end_time,
} else {
log_entry = new LogEntry;
log_entry->output = path;
- log_.insert(make_pair(log_entry->output.c_str(), log_entry));
+ log_.insert(Log::value_type(log_entry->output, log_entry));
}
log_entry->command = command;
log_entry->start_time = start_time;
@@ -169,7 +169,7 @@ bool BuildLog::Load(const string& path, string* err) {
} else {
entry = new LogEntry;
entry->output = output;
- log_.insert(make_pair(entry->output, entry));
+ log_.insert(Log::value_type(entry->output, entry));
++unique_entry_count;
}
++total_entry_count;