diff options
author | Konstantin Kharlamov <Hi-Angel@yandex.ru> | 2019-10-22 18:00:08 (GMT) |
---|---|---|
committer | Konstantin Kharlamov <Hi-Angel@yandex.ru> | 2019-11-20 21:40:11 (GMT) |
commit | 5fe25d2e03ffe71717df3e422303ee1973567d9f (patch) | |
tree | b407234797d62412a71e576ea60f6dc401df739f | |
parent | 59c9a00519b31c2799d20f7937b86a1618bd01f0 (diff) | |
download | Ninja-5fe25d2e03ffe71717df3e422303ee1973567d9f.zip Ninja-5fe25d2e03ffe71717df3e422303ee1973567d9f.tar.gz Ninja-5fe25d2e03ffe71717df3e422303ee1973567d9f.tar.bz2 |
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.cc | 6 |
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); |