You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2017/04/16 16:53:50 UTC

[trafficserver] branch modernize-pass-by-value created (now 4483d74)

This is an automated email from the ASF dual-hosted git repository.

bcall pushed a change to branch modernize-pass-by-value
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.

        at  4483d74   Ran clang-tidy with modernize-pass-by-value

This branch includes the following new commits:

       new  4483d74   Ran clang-tidy with modernize-pass-by-value

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].

[trafficserver] 01/01: Ran clang-tidy with modernize-pass-by-value

Posted by bc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch modernize-pass-by-value
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 4483d74e57685dd4e9452dd3c6b26779ac9a9f30
Author: Bryan Call <bc...@apache.org>
AuthorDate: Sat Apr 15 02:15:47 2017 -0700

    Ran clang-tidy with modernize-pass-by-value
---
 cmd/traffic_cop/traffic_cop.cc                      | 3 ++-
 example/cppapi/async_http_fetch/AsyncHttpFetch.cc   | 3 ++-
 example/cppapi/clientredirect/ClientRedirect.cc     | 5 +++--
 example/cppapi/customresponse/CustomResponse.cc     | 5 +++--
 iocore/hostdb/HostDB.cc                             | 3 ++-
 lib/cppapi/AsyncHttpFetch.cc                        | 3 ++-
 lib/ts/test_PriorityQueue.cc                        | 3 ++-
 lib/ts/test_Scalar.cc                               | 3 ++-
 plugins/experimental/multiplexer/dispatch.cc        | 4 +++-
 plugins/experimental/multiplexer/dispatch.h         | 2 +-
 plugins/experimental/stream_editor/stream_editor.cc | 3 ++-
 11 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/cmd/traffic_cop/traffic_cop.cc b/cmd/traffic_cop/traffic_cop.cc
index 1154062..a784df7 100644
--- a/cmd/traffic_cop/traffic_cop.cc
+++ b/cmd/traffic_cop/traffic_cop.cc
@@ -39,6 +39,7 @@
 
 #include <string>
 #include <map>
+#include <utility>
 
 #if defined(linux) || defined(solaris)
 #include "sys/utsname.h"
@@ -150,7 +151,7 @@ static void get_admin_user(void);
 
 struct ConfigValue {
   ConfigValue() : config_type(RECT_NULL), data_type(RECD_NULL) {}
-  ConfigValue(RecT _t, RecDataT _d, const std::string &_v) : config_type(_t), data_type(_d), data_value(_v) {}
+  ConfigValue(RecT _t, RecDataT _d, std::string _v) : config_type(_t), data_type(_d), data_value(std::move(_v)) {}
   RecT config_type;
   RecDataT data_type;
   std::string data_value;
diff --git a/example/cppapi/async_http_fetch/AsyncHttpFetch.cc b/example/cppapi/async_http_fetch/AsyncHttpFetch.cc
index 7ffb5c6..608982c 100644
--- a/example/cppapi/async_http_fetch/AsyncHttpFetch.cc
+++ b/example/cppapi/async_http_fetch/AsyncHttpFetch.cc
@@ -25,6 +25,7 @@
 #include <atscppapi/PluginInit.h>
 #include <cstring>
 #include <cassert>
+#include <utility>
 
 using namespace atscppapi;
 using std::string;
@@ -54,7 +55,7 @@ class DelayedAsyncHttpFetch : public AsyncHttpFetch, public AsyncReceiver<AsyncT
 {
 public:
   DelayedAsyncHttpFetch(string request, HttpMethod method, std::shared_ptr<Mutex> mutex)
-    : AsyncHttpFetch(request, method), mutex_(mutex), timer_(nullptr){};
+    : AsyncHttpFetch(request, method), mutex_(std::move(mutex)), timer_(nullptr){};
   void
   run() override
   {
diff --git a/example/cppapi/clientredirect/ClientRedirect.cc b/example/cppapi/clientredirect/ClientRedirect.cc
index 051d8f6..565dce9 100644
--- a/example/cppapi/clientredirect/ClientRedirect.cc
+++ b/example/cppapi/clientredirect/ClientRedirect.cc
@@ -17,6 +17,7 @@
  */
 
 #include <iostream>
+#include <utility>
 #include <atscppapi/GlobalPlugin.h>
 #include <atscppapi/TransactionPlugin.h>
 #include <atscppapi/PluginInit.h>
@@ -36,8 +37,8 @@ GlobalPlugin *plugin;
 class ClientRedirectTransactionPlugin : public atscppapi::TransactionPlugin
 {
 public:
-  ClientRedirectTransactionPlugin(Transaction &transaction, const string &location)
-    : TransactionPlugin(transaction), location_(location)
+  ClientRedirectTransactionPlugin(Transaction &transaction, string location)
+    : TransactionPlugin(transaction), location_(std::move(location))
   {
     //
     // We will set this transaction to jump to error state and then we will setup
diff --git a/example/cppapi/customresponse/CustomResponse.cc b/example/cppapi/customresponse/CustomResponse.cc
index 69ed4a9..2665e4a 100644
--- a/example/cppapi/customresponse/CustomResponse.cc
+++ b/example/cppapi/customresponse/CustomResponse.cc
@@ -18,6 +18,7 @@
 
 #include <iostream>
 #include <string>
+#include <utility>
 #include <atscppapi/GlobalPlugin.h>
 #include <atscppapi/TransactionPlugin.h>
 #include <atscppapi/PluginInit.h>
@@ -45,8 +46,8 @@ GlobalPlugin *plugin;
 class CustomResponseTransactionPlugin : public atscppapi::TransactionPlugin
 {
 public:
-  CustomResponseTransactionPlugin(Transaction &transaction, HttpStatus status, const string &reason, const string &body)
-    : TransactionPlugin(transaction), status_(status), reason_(reason), body_(body)
+  CustomResponseTransactionPlugin(Transaction &transaction, HttpStatus status, string reason, string body)
+    : TransactionPlugin(transaction), status_(status), reason_(std::move(reason)), body_(std::move(body))
   {
     TransactionPlugin::registerHook(HOOK_SEND_RESPONSE_HEADERS);
     transaction.error(body_); // Set the error body now, and change the status and reason later.
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 4ff5a01..69de227 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -29,6 +29,7 @@
 #include "Show.h"
 #include "ts/Tokenizer.h"
 
+#include <utility>
 #include <vector>
 #include <algorithm>
 
@@ -269,7 +270,7 @@ struct HostDBSync : public HostDBBackgroundTask {
   std::string storage_path;
   std::string full_path;
   HostDBSync(int frequency, std::string storage_path, std::string full_path)
-    : HostDBBackgroundTask(frequency), storage_path(storage_path), full_path(full_path){};
+    : HostDBBackgroundTask(frequency), storage_path(std::move(storage_path)), full_path(std::move(full_path)){};
   int
   sync_event(int, void *) override
   {
diff --git a/lib/cppapi/AsyncHttpFetch.cc b/lib/cppapi/AsyncHttpFetch.cc
index 6985a68..82f9ffa 100644
--- a/lib/cppapi/AsyncHttpFetch.cc
+++ b/lib/cppapi/AsyncHttpFetch.cc
@@ -30,6 +30,7 @@
 
 #include <cstdio>
 #include <cstring>
+#include <utility>
 
 using namespace atscppapi;
 using std::string;
@@ -54,7 +55,7 @@ struct atscppapi::AsyncHttpFetchState : noncopyable {
 
   AsyncHttpFetchState(const string &url_str, HttpMethod http_method, string request_body,
                       AsyncHttpFetch::StreamingFlag streaming_flag)
-    : request_body_(request_body),
+    : request_body_(std::move(request_body)),
       result_(AsyncHttpFetch::RESULT_FAILURE),
       body_(nullptr),
       body_size_(0),
diff --git a/lib/ts/test_PriorityQueue.cc b/lib/ts/test_PriorityQueue.cc
index 21f1b21..e13c33e 100644
--- a/lib/ts/test_PriorityQueue.cc
+++ b/lib/ts/test_PriorityQueue.cc
@@ -22,6 +22,7 @@
 */
 
 #include <iostream>
+#include <utility>
 #include <string.h>
 
 #include <ts/TestBox.h>
@@ -33,7 +34,7 @@ using namespace std;
 class N
 {
 public:
-  N(uint32_t w, string c) : weight(w), content(c) {}
+  N(uint32_t w, string c) : weight(w), content(std::move(c)) {}
   bool
   operator<(const N &n) const
   {
diff --git a/lib/ts/test_Scalar.cc b/lib/ts/test_Scalar.cc
index 72e014b..9734dea 100644
--- a/lib/ts/test_Scalar.cc
+++ b/lib/ts/test_Scalar.cc
@@ -25,6 +25,7 @@
 #include <string>
 #include <stdarg.h>
 #include <iostream>
+#include <utility>
 
 namespace ts
 {
@@ -47,7 +48,7 @@ struct TestBox {
   static int _fail;
 
   TestBox(char const *name) : _name(name) {}
-  TestBox(std::string const &name) : _name(name) {}
+  TestBox(std::string name) : _name(std::move(name)) {}
   template <typename... Rest>
   bool
   result(bool r, Rest &&... rest)
diff --git a/plugins/experimental/multiplexer/dispatch.cc b/plugins/experimental/multiplexer/dispatch.cc
index ca031bd..e0bdb80 100644
--- a/plugins/experimental/multiplexer/dispatch.cc
+++ b/plugins/experimental/multiplexer/dispatch.cc
@@ -23,6 +23,8 @@
 #include <inttypes.h>
 #include <sys/time.h>
 
+#include <utility>
+
 #include "dispatch.h"
 #include "fetcher.h"
 #include "original-request.h"
@@ -35,7 +37,7 @@ extern Statistics statistics;
 
 extern size_t timeout;
 
-Request::Request(const std::string &h, const TSMBuffer b, const TSMLoc l) : host(h), length(0), io(new ats::io::IO())
+Request::Request(std::string h, const TSMBuffer b, const TSMLoc l) : host(std::move(h)), length(0), io(new ats::io::IO())
 {
   assert(!host.empty());
   assert(b != nullptr);
diff --git a/plugins/experimental/multiplexer/dispatch.h b/plugins/experimental/multiplexer/dispatch.h
index 678fa58..f5ed4b3 100644
--- a/plugins/experimental/multiplexer/dispatch.h
+++ b/plugins/experimental/multiplexer/dispatch.h
@@ -53,7 +53,7 @@ struct Request {
   int length;
   std::unique_ptr<ats::io::IO> io;
 
-  Request(const std::string &, const TSMBuffer, const TSMLoc);
+  Request(std::string , const TSMBuffer, const TSMLoc);
   Request(const Request &);
   Request &operator=(const Request &);
 };
diff --git a/plugins/experimental/stream_editor/stream_editor.cc b/plugins/experimental/stream_editor/stream_editor.cc
index 01286c8..ff55e8e 100644
--- a/plugins/experimental/stream_editor/stream_editor.cc
+++ b/plugins/experimental/stream_editor/stream_editor.cc
@@ -90,6 +90,7 @@
 
 #include <stdint.h>
 
+#include <utility>
 #include <vector>
 #include <set>
 #include <regex.h>
@@ -109,7 +110,7 @@ struct edit_t {
   const size_t bytes;
   const std::string repl;
   const int priority;
-  edit_t(size_t s, size_t b, const std::string &r, int p) : start(s), bytes(b), repl(r), priority(p) { ; }
+  edit_t(size_t s, size_t b, std::string r, int p) : start(s), bytes(b), repl(std::move(r)), priority(p) { ; }
   bool
   operator!=(const edit_t &x) const
   {

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.