Repository: mesos Updated Branches: refs/heads/master a03b96f55 -> 36ec7f22d
Fix capture by reference of temporary strings in Stout. Review: https://reviews.apache.org/r/33272 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/9a2a313d Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/9a2a313d Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/9a2a313d Branch: refs/heads/master Commit: 9a2a313df30ef6994efe16c3e7f3c8d61edd1209 Parents: a03b96f Author: Joris Van Remoortere <[email protected]> Authored: Tue Jun 2 07:52:04 2015 -0700 Committer: Benjamin Hindman <[email protected]> Committed: Tue Jun 2 07:52:05 2015 -0700 ---------------------------------------------------------------------- .../3rdparty/stout/include/stout/bytes.hpp | 2 +- .../3rdparty/stout/include/stout/duration.hpp | 2 +- .../stout/include/stout/flags/fetch.hpp | 2 +- .../3rdparty/stout/tests/flags_tests.cpp | 4 +-- .../3rdparty/stout/tests/os_tests.cpp | 28 ++++++++++---------- 5 files changed, 19 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/9a2a313d/3rdparty/libprocess/3rdparty/stout/include/stout/bytes.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/bytes.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/bytes.hpp index 0e8385b..451a53d 100644 --- a/3rdparty/libprocess/3rdparty/stout/include/stout/bytes.hpp +++ b/3rdparty/libprocess/3rdparty/stout/include/stout/bytes.hpp @@ -49,7 +49,7 @@ public: return Error(value.error()); } - const std::string& unit = strings::upper(s.substr(index)); + const std::string unit = strings::upper(s.substr(index)); if (unit == "B") { return Bytes(value.get(), BYTES); http://git-wip-us.apache.org/repos/asf/mesos/blob/9a2a313d/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp index 8a1626c..ac823f1 100644 --- a/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp +++ b/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp @@ -45,7 +45,7 @@ public: return Error(value.error()); } - const std::string& unit = s.substr(index); + const std::string unit = s.substr(index); if (unit == "ns") { return Duration(value.get(), NANOSECONDS); http://git-wip-us.apache.org/repos/asf/mesos/blob/9a2a313d/3rdparty/libprocess/3rdparty/stout/include/stout/flags/fetch.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/flags/fetch.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/flags/fetch.hpp index 1df982c..3c320a3 100644 --- a/3rdparty/libprocess/3rdparty/stout/include/stout/flags/fetch.hpp +++ b/3rdparty/libprocess/3rdparty/stout/include/stout/flags/fetch.hpp @@ -44,7 +44,7 @@ Try<T> fetch(const std::string& value) // TODO(cmaloney): Introduce fetching for things beyond just file:// // such as http:// as well! if (strings::startsWith(value, "file://")) { - const std::string& path = value.substr(7); + const std::string path = value.substr(7); Try<std::string> read = os::read(path); if (read.isError()) { http://git-wip-us.apache.org/repos/asf/mesos/blob/9a2a313d/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 a6e8ba9..8045018 100644 --- a/3rdparty/libprocess/3rdparty/stout/tests/flags_tests.cpp +++ b/3rdparty/libprocess/3rdparty/stout/tests/flags_tests.cpp @@ -645,7 +645,7 @@ TEST_F(FlagsFileTest, JSONFile) object.values["nested"] = nested; // Write the JSON to a file. - const string& file = path::join(os::getcwd(), "file.json"); + const string file = path::join(os::getcwd(), "file.json"); ASSERT_SOME(os::write(file, stringify(object))); // Read the JSON from the file. @@ -669,7 +669,7 @@ TEST_F(FlagsFileTest, FilePrefix) "arg to be loaded from file"); // Write the JSON to a file. - const string& file = path::join(os::getcwd(), "file"); + const string file = path::join(os::getcwd(), "file"); ASSERT_SOME(os::write(file, "testing")); // Read the JSON from the file. http://git-wip-us.apache.org/repos/asf/mesos/blob/9a2a313d/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 12b2e1b..7ea9475 100644 --- a/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp +++ b/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp @@ -75,8 +75,8 @@ TEST_F(OsTest, environment) if (position == std::string::npos) { continue; // Skip malformed environment entries. } - const string& key = entry.substr(0, position); - const string& value = entry.substr(position + 1); + const string key = entry.substr(0, position); + const string value = entry.substr(position + 1); EXPECT_TRUE(environment.contains(key)); EXPECT_EQ(value, environment[key]); } @@ -86,7 +86,7 @@ TEST_F(OsTest, environment) TEST_F(OsTest, rmdir) { const hashset<string> EMPTY; - const string& tmpdir = os::getcwd(); + const string tmpdir = os::getcwd(); hashset<string> expectedListing = EMPTY; EXPECT_EQ(expectedListing, listfiles(tmpdir)); @@ -185,7 +185,7 @@ TEST_F(OsTest, nonblock) TEST_F(OsTest, touch) { - const string& testfile = path::join(os::getcwd(), UUID::random().toString()); + const string testfile = path::join(os::getcwd(), UUID::random().toString()); ASSERT_SOME(os::touch(testfile)); ASSERT_TRUE(os::exists(testfile)); @@ -194,8 +194,8 @@ TEST_F(OsTest, touch) TEST_F(OsTest, readWriteString) { - const string& testfile = path::join(os::getcwd(), UUID::random().toString()); - const string& teststr = "line1\nline2"; + const string testfile = path::join(os::getcwd(), UUID::random().toString()); + const string teststr = "line1\nline2"; ASSERT_SOME(os::write(testfile, teststr)); @@ -240,14 +240,14 @@ TEST_F(OsTest, size) TEST_F(OsTest, find) { - const string& testdir = path::join(os::getcwd(), UUID::random().toString()); - const string& subdir = testdir + "/test1"; + const string testdir = path::join(os::getcwd(), UUID::random().toString()); + const string subdir = testdir + "/test1"; ASSERT_SOME(os::mkdir(subdir)); // Create the directories. // Now write some files. - const string& file1 = testdir + "/file1.txt"; - const string& file2 = subdir + "/file2.txt"; - const string& file3 = subdir + "/file3.jpg"; + const string file1 = testdir + "/file1.txt"; + const string file2 = subdir + "/file2.txt"; + const string file3 = subdir + "/file3.jpg"; ASSERT_SOME(os::touch(file1)); ASSERT_SOME(os::touch(file2)); @@ -943,9 +943,9 @@ TEST_F(OsTest, Mknod) return; } - const string& device = "null"; + const string device = "null"; - const string& existing = path::join("/dev", device); + const string existing = path::join("/dev", device); ASSERT_TRUE(os::exists(existing)); Try<mode_t> mode = os::stat::mode(existing); @@ -954,7 +954,7 @@ TEST_F(OsTest, Mknod) Try<dev_t> rdev = os::stat::rdev(existing); ASSERT_SOME(rdev); - const string& another = path::join(os::getcwd(), device); + const string another = path::join(os::getcwd(), device); ASSERT_FALSE(os::exists(another)); EXPECT_SOME(os::mknod(another, mode.get(), rdev.get()));
