Make |log_| variable private to BuildLog.
authorEvan Martin <martine@danga.com>
Thu, 5 Apr 2012 00:26:50 +0000 (17:26 -0700)
committerEvan Martin <martine@danga.com>
Thu, 5 Apr 2012 00:26:50 +0000 (17:26 -0700)
This fix the TODO in build_log.h file.

Signed-off-by: Thiago Farina <tfarina@chromium.org>
src/build_log.h
src/build_log_test.cc

index 040609d..da8e726 100644 (file)
@@ -71,10 +71,11 @@ struct BuildLog {
   /// Rewrite the known log entries, throwing away old data.
   bool Recompact(const string& path, string* err);
 
-  // TODO: make these private.
   typedef ExternalStringHashMap<LogEntry*>::Type Log;
+  const Log& log() const { return log_; }
+
+ private:
   Log log_;
-private:
   FILE* log_file_;
   BuildConfig* config_;
   bool needs_recompaction_;
index c6d6bc3..9b729c7 100644 (file)
@@ -54,8 +54,8 @@ TEST_F(BuildLogTest, WriteRead) {
   EXPECT_TRUE(log2.Load(kTestFilename, &err));
   ASSERT_EQ("", err);
 
-  ASSERT_EQ(2u, log1.log_.size());
-  ASSERT_EQ(2u, log2.log_.size());
+  ASSERT_EQ(2u, log1.log().size());
+  ASSERT_EQ(2u, log2.log().size());
   BuildLog::LogEntry* e1 = log1.LookupByOutput("out");
   ASSERT_TRUE(e1);
   BuildLog::LogEntry* e2 = log2.LookupByOutput("out");