update_engine: Remove unused utils functions.

These functions are not used anymore.

BUG=None
TEST=emerge-link update_engine

Change-Id: I7de8a81af52a4d161ff81f99d53733a9cf2f3825
Reviewed-on: https://chromium-review.googlesource.com/281343
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/utils.cc b/utils.cc
index 8fba231..ec05062 100644
--- a/utils.cc
+++ b/utils.cc
@@ -556,17 +556,6 @@
   return strerror_r(err, buf, sizeof(buf));
 }
 
-string NormalizePath(const string& path, bool strip_trailing_slash) {
-  string ret;
-  std::unique_copy(path.begin(), path.end(), std::back_inserter(ret),
-                   [](char c1, char c2) { return c1 == c2 && c1 == '/'; });
-  // The above code ensures no "//" is present in the string, so at most one
-  // '/' is present at the end of the line.
-  if (strip_trailing_slash && !ret.empty() && ret.back() == '/')
-    ret.pop_back();
-  return ret;
-}
-
 bool FileExists(const char* path) {
   struct stat stbuf;
   return 0 == lstat(path, &stbuf);
@@ -577,12 +566,6 @@
   return lstat(path, &stbuf) == 0 && S_ISLNK(stbuf.st_mode) != 0;
 }
 
-bool IsDir(const char* path) {
-  struct stat stbuf;
-  TEST_AND_RETURN_FALSE_ERRNO(lstat(path, &stbuf) == 0);
-  return S_ISDIR(stbuf.st_mode);
-}
-
 bool TryAttachingUbiVolume(int volume_num, int timeout) {
   const string volume_path = base::StringPrintf("/dev/ubi%d_0", volume_num);
   if (FileExists(volume_path.c_str())) {
diff --git a/utils.h b/utils.h
index 8f30ebd..7a506c5 100644
--- a/utils.h
+++ b/utils.h
@@ -115,10 +115,6 @@
 
 std::string ErrnoNumberAsString(int err);
 
-// Strips duplicate slashes, and optionally removes all trailing slashes.
-// Does not compact /./ or /../.
-std::string NormalizePath(const std::string& path, bool strip_trailing_slash);
-
 // Returns true if the file exists for sure. Returns false if it doesn't exist,
 // or an error occurs.
 bool FileExists(const char* path);
@@ -126,9 +122,6 @@
 // Returns true if |path| exists and is a symbolic link.
 bool IsSymlink(const char* path);
 
-// Returns true if |path| exists and is a directory.
-bool IsDir(const char* path);
-
 // Try attaching UBI |volume_num|. If there is any error executing required
 // commands to attach the volume, this function returns false. This function
 // only returns true if "/dev/ubi%d_0" becomes available in |timeout| seconds.
diff --git a/utils_unittest.cc b/utils_unittest.cc
index cd91279..2c30d30 100644
--- a/utils_unittest.cc
+++ b/utils_unittest.cc
@@ -78,38 +78,6 @@
   EXPECT_EQ("", utils::KernelDeviceOfBootDevice("/dev/ubiblock4_0"));
 }
 
-
-TEST(UtilsTest, NormalizePathTest) {
-  EXPECT_EQ("", utils::NormalizePath("", false));
-  EXPECT_EQ("", utils::NormalizePath("", true));
-  EXPECT_EQ("/", utils::NormalizePath("/", false));
-  EXPECT_EQ("", utils::NormalizePath("/", true));
-  EXPECT_EQ("/", utils::NormalizePath("//", false));
-  EXPECT_EQ("", utils::NormalizePath("//", true));
-  EXPECT_EQ("foo", utils::NormalizePath("foo", false));
-  EXPECT_EQ("foo", utils::NormalizePath("foo", true));
-  EXPECT_EQ("/foo/", utils::NormalizePath("/foo//", false));
-  EXPECT_EQ("/foo", utils::NormalizePath("/foo//", true));
-  EXPECT_EQ("bar/baz/foo/adlr", utils::NormalizePath("bar/baz//foo/adlr",
-                                                     false));
-  EXPECT_EQ("bar/baz/foo/adlr", utils::NormalizePath("bar/baz//foo/adlr",
-                                                     true));
-  EXPECT_EQ("/bar/baz/foo/adlr/", utils::NormalizePath("/bar/baz//foo/adlr/",
-                                                       false));
-  EXPECT_EQ("/bar/baz/foo/adlr", utils::NormalizePath("/bar/baz//foo/adlr/",
-                                                      true));
-  EXPECT_EQ("\\\\", utils::NormalizePath("\\\\", false));
-  EXPECT_EQ("\\\\", utils::NormalizePath("\\\\", true));
-  EXPECT_EQ("\\:/;$PATH\n\\",
-            utils::NormalizePath("\\://;$PATH\n\\", false));
-  EXPECT_EQ("\\:/;$PATH\n\\",
-            utils::NormalizePath("\\://;$PATH\n\\", true));
-  EXPECT_EQ("/spaces s/ ok/s / / /",
-            utils::NormalizePath("/spaces s/ ok/s / / /", false));
-  EXPECT_EQ("/spaces s/ ok/s / / ",
-            utils::NormalizePath("/spaces s/ ok/s / / /", true));
-}
-
 TEST(UtilsTest, ReadFileFailure) {
   chromeos::Blob empty;
   EXPECT_FALSE(utils::ReadFile("/this/doesn't/exist", &empty));
@@ -154,20 +122,6 @@
   EXPECT_TRUE(test_utils::RecursiveUnlinkDir(temp_dir));
 }
 
-TEST(UtilsTest, IsDirTest) {
-  string temp_dir;
-  EXPECT_TRUE(utils::MakeTempDirectory("isdir-test.XXXXXX", &temp_dir));
-  string temp_file = temp_dir + "/temp-file";
-  EXPECT_TRUE(utils::WriteFile(temp_file.c_str(), "", 0));
-  string temp_symlink = temp_dir + "/temp-symlink";
-  EXPECT_EQ(0, symlink(temp_dir.c_str(), temp_symlink.c_str()));
-  EXPECT_TRUE(utils::IsDir(temp_dir.c_str()));
-  EXPECT_FALSE(utils::IsDir(temp_file.c_str()));
-  EXPECT_FALSE(utils::IsDir(temp_symlink.c_str()));
-  EXPECT_FALSE(utils::IsDir("/non/existent/path"));
-  ASSERT_TRUE(test_utils::RecursiveUnlinkDir(temp_dir));
-}
-
 TEST(UtilsTest, GetDiskNameTest) {
   EXPECT_EQ("/dev/sda", utils::GetDiskName("/dev/sda3"));
   EXPECT_EQ("/dev/sdp", utils::GetDiskName("/dev/sdp1234"));