summaryrefslogtreecommitdiffstats
path: root/src/build_log.cc
diff options
context:
space:
mode:
authorMaxim Kalaev <maximk@il.ibm.com>2012-10-12 06:59:49 (GMT)
committerMaxim Kalaev <maximk@il.ibm.com>2012-10-12 07:16:51 (GMT)
commit96e01852b3060f37f20784ee0941d13d8f592794 (patch)
tree63af05153a4eae391f9f998728c98a5b0e04a9b3 /src/build_log.cc
parent9e8bfe0365ccf78a524c0733a33b5bac2dc66f5a (diff)
downloadNinja-96e01852b3060f37f20784ee0941d13d8f592794.zip
Ninja-96e01852b3060f37f20784ee0941d13d8f592794.tar.gz
Ninja-96e01852b3060f37f20784ee0941d13d8f592794.tar.bz2
build log: mini-refactoring to use constructors to initialize entries
Diffstat (limited to 'src/build_log.cc')
-rw-r--r--src/build_log.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/build_log.cc b/src/build_log.cc
index 19e1c14..28fcf88 100644
--- a/src/build_log.cc
+++ b/src/build_log.cc
@@ -91,6 +91,15 @@ uint64_t BuildLog::LogEntry::HashCommand(StringPiece command) {
return MurmurHash64A(command.str_, command.len_);
}
+BuildLog::LogEntry::LogEntry(const string& _output)
+ : output(_output) {}
+
+BuildLog::LogEntry::LogEntry(const string& _output, uint64_t _command_hash,
+ int _start_time, int _end_time, TimeStamp _restat_mtime)
+ : output(_output), command_hash(_command_hash),
+ start_time(_start_time), end_time(_end_time), restat_mtime(_restat_mtime)
+{}
+
BuildLog::BuildLog()
: log_file_(NULL), needs_recompaction_(false) {}
@@ -139,8 +148,7 @@ void BuildLog::RecordCommand(Edge* edge, int start_time, int end_time,
if (i != entries_.end()) {
log_entry = i->second;
} else {
- log_entry = new LogEntry;
- log_entry->output = path;
+ log_entry = new LogEntry(path);
entries_.insert(Entries::value_type(log_entry->output, log_entry));
}
log_entry->command_hash = command_hash;
@@ -288,8 +296,7 @@ bool BuildLog::Load(const string& path, string* err) {
if (i != entries_.end()) {
entry = i->second;
} else {
- entry = new LogEntry;
- entry->output = output;
+ entry = new LogEntry(output);
entries_.insert(Entries::value_type(entry->output, entry));
++unique_entry_count;
}