From 8d03d2cf7e572b65cd242a44081b514338e4fd6b Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 30 Apr 2013 08:40:56 -0700 Subject: [PATCH] Move some DepsLog::Deps initialization code into its constructor. No functionality change. --- src/deps_log.cc | 5 +---- src/deps_log.h | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/deps_log.cc b/src/deps_log.cc index 8dc6e69..c2587af 100644 --- a/src/deps_log.cc +++ b/src/deps_log.cc @@ -179,10 +179,7 @@ bool DepsLog::Load(const string& path, State* state, string* err) { deps_data += 2; int deps_count = (size / 4) - 2; - Deps* deps = new Deps; - deps->mtime = mtime; - deps->node_count = deps_count; - deps->nodes = new Node*[deps_count]; + Deps* deps = new Deps(mtime, deps_count); for (int i = 0; i < deps_count; ++i) { assert(deps_data[i] < (int)nodes_.size()); assert(nodes_[deps_data[i]]); diff --git a/src/deps_log.h b/src/deps_log.h index 4b357a8..820997e 100644 --- a/src/deps_log.h +++ b/src/deps_log.h @@ -72,7 +72,8 @@ struct DepsLog { // Reading (startup-time) interface. struct Deps { - Deps() : mtime(-1), node_count(0), nodes(NULL) {} + Deps(int mtime, int node_count) + : mtime(mtime), node_count(node_count), nodes(new Node*[node_count]) {} ~Deps() { delete [] nodes; } int mtime; int node_count; -- 2.7.4