You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/02/04 03:13:29 UTC

[3/3] mesos git commit: Cleaned up usage of qualified identifiers in stout.

Cleaned up usage of qualified identifiers in stout.

For example, avoid using `std::string` in a `.cpp` file that already has
a using declaration: `using std::string`.

Review: https://reviews.apache.org/r/42617/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/000c617b
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/000c617b
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/000c617b

Branch: refs/heads/master
Commit: 000c617b96b7629cda21d781e257048e7c514556
Parents: 0b0a3dc
Author: Neil Conway <ne...@gmail.com>
Authored: Wed Feb 3 16:50:24 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Wed Feb 3 18:12:58 2016 -0800

----------------------------------------------------------------------
 .../3rdparty/stout/tests/flags_tests.cpp        |  2 +-
 .../stout/tests/linkedhashmap_tests.cpp         |  2 +-
 .../stout/tests/os/filesystem_tests.cpp         | 11 ++++----
 .../3rdparty/stout/tests/os_tests.cpp           | 28 ++++++++++----------
 .../3rdparty/stout/tests/some_tests.cpp         | 20 +++++++-------
 .../3rdparty/stout/tests/strings_tests.cpp      |  4 +--
 6 files changed, 34 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/000c617b/3rdparty/libprocess/3rdparty/stout/tests/flags_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/flags_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/flags_tests.cpp
index 5a10f59..e87bee2 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/flags_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/flags_tests.cpp
@@ -711,7 +711,7 @@ TEST_F(FlagsFileTest, FilePrefix)
 {
   Flags<TestFlags> flags;
 
-  Option<std::string> something;
+  Option<string> something;
 
   flags.add(&something,
             "something",

http://git-wip-us.apache.org/repos/asf/mesos/blob/000c617b/3rdparty/libprocess/3rdparty/stout/tests/linkedhashmap_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/linkedhashmap_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/linkedhashmap_tests.cpp
index 21a98b8..7a80769 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/linkedhashmap_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/linkedhashmap_tests.cpp
@@ -72,7 +72,7 @@ TEST(LinkedHashmapTest, Keys)
 {
   LinkedHashMap<string, int> map;
 
-  std::list<string> keys;
+  list<string> keys;
   keys.push_back("foo");
   keys.push_back("bar");
   keys.push_back("food");

http://git-wip-us.apache.org/repos/asf/mesos/blob/000c617b/3rdparty/libprocess/3rdparty/stout/tests/os/filesystem_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/os/filesystem_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/os/filesystem_tests.cpp
index 01e4b2f..d0592ef 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/os/filesystem_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/os/filesystem_tests.cpp
@@ -40,7 +40,7 @@ using std::string;
 static hashset<string> listfiles(const string& directory)
 {
   hashset<string> fileset;
-  Try<std::list<std::string>> entries = os::ls(directory);
+  Try<list<string>> entries = os::ls(directory);
   if (entries.isSome()) {
     foreach (const string& entry, entries.get()) {
       fileset.insert(entry);
@@ -69,7 +69,7 @@ TEST_F(FsTest, Find)
   ASSERT_SOME(os::touch(file3));
 
   // Find "*.txt" files.
-  Try<std::list<string>> result = os::find(testdir, ".txt");
+  Try<list<string>> result = os::find(testdir, ".txt");
   ASSERT_SOME(result);
 
   hashset<string> files;
@@ -176,16 +176,15 @@ TEST_F(FsTest, List)
   ASSERT_SOME(os::touch(file3));
 
   // Search all files in folder
-  Try<std::list<std::string>> allFiles = fs::list(path::join(testdir, "*"));
+  Try<list<string>> allFiles = fs::list(path::join(testdir, "*"));
   ASSERT_TRUE(allFiles.get().size() == 3);
 
   // Search .jpg files in folder
-  Try<std::list<std::string>> jpgFiles = fs::list(path::join(testdir, "*.jpg"));
+  Try<list<string>> jpgFiles = fs::list(path::join(testdir, "*.jpg"));
   ASSERT_TRUE(jpgFiles.get().size() == 1);
 
   // Search test*.txt files in folder
-  Try<std::list<std::string>> testTxtFiles =
-    fs::list(path::join(testdir, "*.txt"));
+  Try<list<string>> testTxtFiles = fs::list(path::join(testdir, "*.txt"));
 
   ASSERT_TRUE(testTxtFiles.get().size() == 2);
 }

http://git-wip-us.apache.org/repos/asf/mesos/blob/000c617b/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
index 4b7d134..a2bc5c4 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
@@ -64,7 +64,7 @@ using std::vector;
 static hashset<string> listfiles(const string& directory)
 {
   hashset<string> fileset;
-  Try<std::list<std::string> > entries = os::ls(directory);
+  Try<list<string> > entries = os::ls(directory);
   if (entries.isSome()) {
     foreach (const string& entry, entries.get()) {
       fileset.insert(entry);
@@ -102,9 +102,9 @@ TEST_F(OsTest, Environment)
   hashmap<string, string> environment = os::environment();
 
   for (size_t index = 0; environ[index] != NULL; index++) {
-    std::string entry(environ[index]);
+    string entry(environ[index]);
     size_t position = entry.find_first_of('=');
-    if (position == std::string::npos) {
+    if (position == string::npos) {
       continue; // Skip malformed environment entries.
     }
     const string key = entry.substr(0, position);
@@ -281,7 +281,7 @@ TEST_F(OsTest, Find)
   ASSERT_SOME(os::touch(file3));
 
   // Find "*.txt" files.
-  Try<std::list<string> > result = os::find(testdir, ".txt");
+  Try<list<string> > result = os::find(testdir, ".txt");
   ASSERT_SOME(result);
 
   hashset<string> files;
@@ -632,7 +632,7 @@ TEST_F(OsTest, Killtree)
 
   // Kill the process tree and follow sessions and groups to make sure
   // we cross the broken link due to the grandchild.
-  Try<std::list<ProcessTree> > trees =
+  Try<list<ProcessTree> > trees =
     os::killtree(child, SIGKILL, true, true);
 
   ASSERT_SOME(trees);
@@ -784,7 +784,7 @@ TEST_F(OsTest, KilltreeNoRoot)
   // Kill the process tree. Even though the root process has exited,
   // we specify to follow sessions and groups which should kill the
   // grandchild and greatgrandchild.
-  Try<std::list<ProcessTree>> trees = os::killtree(child, SIGKILL, true, true);
+  Try<list<ProcessTree>> trees = os::killtree(child, SIGKILL, true, true);
 
   ASSERT_SOME(trees);
   EXPECT_FALSE(trees.get().empty());
@@ -945,10 +945,10 @@ TEST_F(OsTest, User)
 // variable (DYLD_LIBRARY_PATH on OS X).
 TEST_F(OsTest, Libraries)
 {
-  const std::string path1 = "/tmp/path1";
-  const std::string path2 = "/tmp/path1";
-  std::string ldLibraryPath;
-  const std::string originalLibraryPath = os::libraries::paths();
+  const string path1 = "/tmp/path1";
+  const string path2 = "/tmp/path1";
+  string ldLibraryPath;
+  const string originalLibraryPath = os::libraries::paths();
 
   // Test setPaths.
   os::libraries::setPaths(path1);
@@ -1041,13 +1041,13 @@ TEST_F(OsTest, Mknod)
 TEST_F(OsTest, Realpath)
 {
   // Create a file.
-  const Try<std::string> _testFile = os::mktemp();
+  const Try<string> _testFile = os::mktemp();
   ASSERT_SOME(_testFile);
   ASSERT_SOME(os::touch(_testFile.get()));
-  const std::string testFile = _testFile.get();
+  const string testFile = _testFile.get();
 
   // Create a symlink pointing to a file.
-  const std::string testLink = UUID::random().toString();
+  const string testLink = UUID::random().toString();
   ASSERT_SOME(fs::symlink(testFile, testLink));
 
   // Validate the symlink.
@@ -1058,7 +1058,7 @@ TEST_F(OsTest, Realpath)
   ASSERT_EQ(fileInode.get(), linkInode.get());
 
   // Verify that the symlink resolves correctly.
-  Result<std::string> resolved = os::realpath(testLink);
+  Result<string> resolved = os::realpath(testLink);
   ASSERT_SOME(resolved);
   EXPECT_TRUE(strings::contains(resolved.get(), testFile));
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/000c617b/3rdparty/libprocess/3rdparty/stout/tests/some_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/some_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/some_tests.cpp
index c0be974..6858735 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/some_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/some_tests.cpp
@@ -22,6 +22,8 @@
 #include <stout/some.hpp>
 #include <stout/try.hpp>
 
+using std::string;
+
 TEST(SomeTest, Some)
 {
   Option<int> o1 = Some(42);
@@ -32,7 +34,7 @@ TEST(SomeTest, Some)
   EXPECT_SOME(r1);
   EXPECT_EQ(42, r1.get());
 
-  Try<Option<int> > t1 = Some(42);
+  Try<Option<int>> t1 = Some(42);
   ASSERT_SOME(t1);
   EXPECT_SOME(t1.get());
   EXPECT_EQ(42, t1.get().get());
@@ -40,40 +42,40 @@ TEST(SomeTest, Some)
   ASSERT_SOME(t1);
   EXPECT_NONE(t1.get());
 
-  Try<Result<int> > t2 = Some(42);
+  Try<Result<int>> t2 = Some(42);
   ASSERT_SOME(t2);
   EXPECT_SOME(t2.get());
   EXPECT_EQ(42, t2.get().get());
 
-  Option<Result<int> > o2 = Some(42);
+  Option<Result<int>> o2 = Some(42);
   ASSERT_SOME(o2);
   EXPECT_SOME(o2.get());
   EXPECT_EQ(42, o2.get().get());
 
-  Option<Result<int> > o3 = Some(Some(42));
+  Option<Result<int>> o3 = Some(Some(42));
   ASSERT_SOME(o3);
   EXPECT_SOME(o3.get());
   EXPECT_EQ(42, o3.get().get());
 
-  Result<Option<int> > r2 = Some(42);
+  Result<Option<int>> r2 = Some(42);
   ASSERT_SOME(r2);
   EXPECT_SOME(r2.get());
   EXPECT_EQ(42, r2.get().get());
 
-  Result<Option<int> > r3 = Some(Some(42));
+  Result<Option<int>> r3 = Some(Some(42));
   ASSERT_SOME(r3);
   EXPECT_SOME(r3.get());
   EXPECT_EQ(42, r3.get().get());
 
-  Option<std::string> o4 = Some("hello");
+  Option<string> o4 = Some("hello");
   EXPECT_SOME(o4);
   EXPECT_EQ("hello", o4.get());
 
-  Result<std::string> r4 = Some("world");
+  Result<string> r4 = Some("world");
   EXPECT_SOME(r4);
   EXPECT_EQ("world", r4.get());
 
-  std::map<std::string, Option<std::string> > values;
+  std::map<string, Option<string>> values;
   values["no-debug"] = None();
   values["debug"] = None();
   values["debug"] = Some("true");

http://git-wip-us.apache.org/repos/asf/mesos/blob/000c617b/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp
index 7715fa4..8e7d3ee 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp
@@ -31,7 +31,7 @@ using std::vector;
 
 TEST(StringsTest, Format)
 {
-  Try<std::string> result = strings::format("%s %s", "hello", "world");
+  Try<string> result = strings::format("%s %s", "hello", "world");
   EXPECT_SOME_EQ("hello world", result);
 
   result = strings::format("hello %d", 42);
@@ -384,7 +384,7 @@ TEST(StringsTest, Join)
   EXPECT_EQ("a\nb\nc\nd", strings::join("\n", "a", "b", "c", "d"));
   std::stringstream ss;
   EXPECT_EQ("a, b, c", strings::join(ss, ", ", "a", "b", "c").str());
-  const std::string gnarly("gnarly");
+  const string gnarly("gnarly");
   EXPECT_EQ("a/gnarly/c", strings::join("/", "a", gnarly, "c"));
   const bool is_true = true;
   const std::set<int32_t> my_set {1, 2, 3};