summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Kharlamov <Hi-Angel@yandex.ru>2019-10-22 21:00:08 +0300
committerKonstantin Kharlamov <Hi-Angel@yandex.ru>2019-11-21 00:40:11 +0300
commit5fe25d2e03ffe71717df3e422303ee1973567d9f (patch)
treeb407234797d62412a71e576ea60f6dc401df739f
parent59c9a00519b31c2799d20f7937b86a1618bd01f0 (diff)
downloadninja-5fe25d2e03ffe71717df3e422303ee1973567d9f.tar.gz
build.cc: constify a map key in RealCommandRunner
Modifying a key in C++ associative containers is UB. Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
-rw-r--r--src/build.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/build.cc b/src/build.cc
index 931fb95..79cea44 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -676,12 +676,12 @@ struct RealCommandRunner : public CommandRunner {
const BuildConfig& config_;
SubprocessSet subprocs_;
- map<Subprocess*, Edge*> subproc_to_edge_;
+ map<const Subprocess*, Edge*> subproc_to_edge_;
};
vector<Edge*> RealCommandRunner::GetActiveEdges() {
vector<Edge*> edges;
- for (map<Subprocess*, Edge*>::iterator e = subproc_to_edge_.begin();
+ for (map<const Subprocess*, Edge*>::iterator e = subproc_to_edge_.begin();
e != subproc_to_edge_.end(); ++e)
edges.push_back(e->second);
return edges;
@@ -720,7 +720,7 @@ bool RealCommandRunner::WaitForCommand(Result* result) {
result->status = subproc->Finish();
result->output = subproc->GetOutput();
- map<Subprocess*, Edge*>::iterator e = subproc_to_edge_.find(subproc);
+ map<const Subprocess*, Edge*>::iterator e = subproc_to_edge_.find(subproc);
result->edge = e->second;
subproc_to_edge_.erase(e);