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 2017/01/10 00:28:23 UTC

[2/3] mesos git commit: Cleaned up `std::string` usage in libprocess.

Cleaned up `std::string` usage in libprocess.

- Avoided redundant initialization to empty string.
- Used `char` overloads instead for single-character string literals.

Spotted with `clang-tidy`.

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


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

Branch: refs/heads/master
Commit: 9fcb719e4525da39aba9eccf497711f35a7885fc
Parents: bf6cd2e
Author: Neil Conway <ne...@gmail.com>
Authored: Mon Jan 9 14:24:20 2017 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Mon Jan 9 16:28:06 2017 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/http.cpp           | 2 +-
 3rdparty/libprocess/src/tests/io_tests.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9fcb719e/3rdparty/libprocess/src/http.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/http.cpp b/3rdparty/libprocess/src/http.cpp
index 131f7ae..b5c38ce 100644
--- a/3rdparty/libprocess/src/http.cpp
+++ b/3rdparty/libprocess/src/http.cpp
@@ -199,7 +199,7 @@ Try<URL> URL::parse(const string& urlString)
   const string scheme = strings::lower(urlString.substr(0, schemePos));
   const string urlPath = urlString.substr(schemePos + 3);
 
-  size_t pathPos = urlPath.find_first_of("/");
+  size_t pathPos = urlPath.find_first_of('/');
   if (pathPos == 0) {
     return Error("Host not found in url");
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/9fcb719e/3rdparty/libprocess/src/tests/io_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/io_tests.cpp b/3rdparty/libprocess/src/tests/io_tests.cpp
index b9825e8..466e343 100644
--- a/3rdparty/libprocess/src/tests/io_tests.cpp
+++ b/3rdparty/libprocess/src/tests/io_tests.cpp
@@ -323,7 +323,7 @@ TEST_F(IOTest, Redirect)
   ASSERT_SOME(os::nonblock(pipes[1]));
 
   // Set up a redirect hook to also accumlate the data that we splice.
-  string accumulated = "";
+  string accumulated;
   lambda::function<void(const string&)> hook =
     [&accumulated](const string& data) {
       accumulated += data;