You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2015/06/02 16:54:36 UTC
[2/4] mesos git commit: Fix capture by reference of temporary strings
in Libprocess.
Fix capture by reference of temporary strings in Libprocess.
Review: https://reviews.apache.org/r/33274
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ef4c4db8
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ef4c4db8
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ef4c4db8
Branch: refs/heads/master
Commit: ef4c4db8be5d7605e426b89bae9fdce76a3ef666
Parents: 9a2a313
Author: Joris Van Remoortere <jo...@gmail.com>
Authored: Tue Jun 2 07:53:03 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Tue Jun 2 07:53:05 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/src/help.cpp | 2 +-
3rdparty/libprocess/src/process.cpp | 6 +++---
3rdparty/libprocess/src/tests/decoder_tests.cpp | 16 ++++++++--------
3rdparty/libprocess/src/tests/encoder_tests.cpp | 2 +-
3rdparty/libprocess/src/tests/http_tests.cpp | 2 +-
3rdparty/libprocess/src/tests/process_tests.cpp | 2 +-
3rdparty/libprocess/src/tests/subprocess_tests.cpp | 2 +-
7 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ef4c4db8/3rdparty/libprocess/src/help.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/help.cpp b/3rdparty/libprocess/src/help.cpp
index ce2de11..e4e0bb6 100644
--- a/3rdparty/libprocess/src/help.cpp
+++ b/3rdparty/libprocess/src/help.cpp
@@ -135,7 +135,7 @@ Future<http::Response> Help::help(const http::Request& request)
document += "## `/" + id.get() + "` ##\n";
foreachkey (const string& name, helps[id.get()]) {
- const string& path = id.get() + name;
+ const string path = id.get() + name;
document += "> [/" + path + "][" + path + "]\n";
references += "[" + path + "]: " + path + "\n";
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/ef4c4db8/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index e3de3cd..304e877 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -486,7 +486,7 @@ static Message* parse(Request* request)
} else {
// Try and get 'from' from the User-Agent.
const string& agent = request->headers["User-Agent"];
- const string& identifier = "libprocess/";
+ const string identifier = "libprocess/";
size_t index = agent.find(identifier);
if (index != string::npos) {
from = UPID(agent.substr(index + identifier.size(), agent.size()));
@@ -513,7 +513,7 @@ static Message* parse(Request* request)
// And now determine 'name'.
index = index != string::npos ? index + 2: request->path.size();
- const string& name = request->path.substr(index);
+ const string name = request->path.substr(index);
VLOG(2) << "Parsed message name '" << name
<< "' for " << to << " from " << from.get();
@@ -2711,7 +2711,7 @@ void ProcessBase::visit(const HttpEvent& event)
CHECK(tokens.size() >= 1);
CHECK_EQ(pid.id, http::decode(tokens[0]).get());
- const string& name = tokens.size() > 1 ? tokens[1] : "";
+ const string name = tokens.size() > 1 ? tokens[1] : "";
if (handlers.http.count(name) > 0) {
// Create the promise to link with whatever gets returned, as well
http://git-wip-us.apache.org/repos/asf/mesos/blob/ef4c4db8/3rdparty/libprocess/src/tests/decoder_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/decoder_tests.cpp b/3rdparty/libprocess/src/tests/decoder_tests.cpp
index efe364a..f8fa798 100644
--- a/3rdparty/libprocess/src/tests/decoder_tests.cpp
+++ b/3rdparty/libprocess/src/tests/decoder_tests.cpp
@@ -23,7 +23,7 @@ TEST(Decoder, Request)
ASSERT_SOME(socket);
DataDecoder decoder = DataDecoder(socket.get());
- const string& data =
+ const string data =
"GET /path/file.json?key1=value1&key2=value2#fragment HTTP/1.1\r\n"
"Host: localhost\r\n"
"Connection: close\r\n"
@@ -61,7 +61,7 @@ TEST(Decoder, RequestHeaderContinuation)
ASSERT_SOME(socket);
DataDecoder decoder = DataDecoder(socket.get());
- const string& data =
+ const string data =
"GET /path/file.json HTTP/1.1\r\n"
"Host: localhost\r\n"
"Connection: close\r\n"
@@ -87,7 +87,7 @@ TEST(Decoder, DISABLED_RequestHeaderCaseInsensitive)
ASSERT_SOME(socket);
DataDecoder decoder = DataDecoder(socket.get());
- const string& data =
+ const string data =
"GET /path/file.json HTTP/1.1\r\n"
"Host: localhost\r\n"
"cOnnECtioN: close\r\n"
@@ -111,7 +111,7 @@ TEST(Decoder, Response)
{
ResponseDecoder decoder;
- const string& data =
+ const string data =
"HTTP/1.1 200 OK\r\n"
"Date: Fri, 31 Dec 1999 23:59:59 GMT\r\n"
"Content-Type: text/plain\r\n"
@@ -139,14 +139,14 @@ TEST(Decoder, StreamingResponse)
{
StreamingResponseDecoder decoder;
- const string& headers =
+ const string headers =
"HTTP/1.1 200 OK\r\n"
"Date: Fri, 31 Dec 1999 23:59:59 GMT\r\n"
"Content-Type: text/plain\r\n"
"Content-Length: 2\r\n"
"\r\n";
- const string& body = "hi";
+ const string body = "hi";
deque<Response*> responses = decoder.decode(headers.data(), headers.length());
ASSERT_FALSE(decoder.failed());
@@ -183,7 +183,7 @@ TEST(Decoder, StreamingResponseFailure)
{
StreamingResponseDecoder decoder;
- const string& headers =
+ const string headers =
"HTTP/1.1 200 OK\r\n"
"Date: Fri, 31 Dec 1999 23:59:59 GMT\r\n"
"Content-Type: text/plain\r\n"
@@ -191,7 +191,7 @@ TEST(Decoder, StreamingResponseFailure)
"\r\n";
// The body is shorter than the content length!
- const string& body = "1";
+ const string body = "1";
deque<Response*> responses = decoder.decode(headers.data(), headers.length());
ASSERT_FALSE(decoder.failed());
http://git-wip-us.apache.org/repos/asf/mesos/blob/ef4c4db8/3rdparty/libprocess/src/tests/encoder_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/encoder_tests.cpp b/3rdparty/libprocess/src/tests/encoder_tests.cpp
index 784a2c7..44996f0 100644
--- a/3rdparty/libprocess/src/tests/encoder_tests.cpp
+++ b/3rdparty/libprocess/src/tests/encoder_tests.cpp
@@ -26,7 +26,7 @@ TEST(Encoder, Response)
const OK response("body");
// Encode the response.
- const string& encoded = HttpResponseEncoder::encode(response, request);
+ const string encoded = HttpResponseEncoder::encode(response, request);
// Now decode it back, and verify the encoding was correct.
ResponseDecoder decoder;
http://git-wip-us.apache.org/repos/asf/mesos/blob/ef4c4db8/3rdparty/libprocess/src/tests/http_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/http_tests.cpp b/3rdparty/libprocess/src/tests/http_tests.cpp
index d29cd29..708e331 100644
--- a/3rdparty/libprocess/src/tests/http_tests.cpp
+++ b/3rdparty/libprocess/src/tests/http_tests.cpp
@@ -143,7 +143,7 @@ TEST(HTTP, Endpoints)
<< "Connection: Keep-Alive\r\n"
<< "\r\n";
- const string& data = out.str();
+ const string data = out.str();
EXPECT_CALL(*http.process, body(_))
.WillOnce(Return(http::OK()));
http://git-wip-us.apache.org/repos/asf/mesos/blob/ef4c4db8/3rdparty/libprocess/src/tests/process_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/process_tests.cpp b/3rdparty/libprocess/src/tests/process_tests.cpp
index 67e582c..0d8a87b 100644
--- a/3rdparty/libprocess/src/tests/process_tests.cpp
+++ b/3rdparty/libprocess/src/tests/process_tests.cpp
@@ -1462,7 +1462,7 @@ TEST(Process, remote)
message.from = UPID();
message.to = process.self();
- const string& data = MessageEncoder::encode(&message);
+ const string data = MessageEncoder::encode(&message);
AWAIT_READY(socket.send(data));
http://git-wip-us.apache.org/repos/asf/mesos/blob/ef4c4db8/3rdparty/libprocess/src/tests/subprocess_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/subprocess_tests.cpp b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
index dea4ed8..b5cfc8d 100644
--- a/3rdparty/libprocess/src/tests/subprocess_tests.cpp
+++ b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
@@ -828,7 +828,7 @@ TEST_F(SubprocessTest, Setup)
ASSERT_SOME(s.get().status().get());
// Make sure 'file' is there and contains 'hello world'.
- const string& path = path::join(directory.get(), "file");
+ const string path = path::join(directory.get(), "file");
EXPECT_TRUE(os::exists(path));
EXPECT_SOME_EQ("hello world\n", os::read(path));