summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2016-07-27 11:42:51 -0700
committerChih-Hung Hsieh <chh@google.com>2016-07-27 11:48:17 -0700
commitf05cc26630828c848e46ea0e584dbdd2541ea723 (patch)
tree448927ca7b53cc8115ffa8ef74d838f5f0a5795c /tests
parent3b2203ddadae8b44ebe14a882274707ba58bc9c3 (diff)
downloadandroid_system_tools_aidl-f05cc26630828c848e46ea0e584dbdd2541ea723.tar.gz
android_system_tools_aidl-f05cc26630828c848e46ea0e584dbdd2541ea723.tar.bz2
android_system_tools_aidl-f05cc26630828c848e46ea0e584dbdd2541ea723.zip
Fix clang-tidy performance warnings.
* Use const reference type for parameters, local variables, and for-loop index variables to avoid unnecessary copy. Bug: 30407689 Bug: 30413223 Bug: 30413862 Change-Id: Ia09c58becfa3980faed24aa7eddeb520207ca259 Test: build with WITH_TIDY=1
Diffstat (limited to 'tests')
-rw-r--r--tests/aidl_test_client_file_descriptors.cpp4
-rw-r--r--tests/aidl_test_client_nullables.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/aidl_test_client_file_descriptors.cpp b/tests/aidl_test_client_file_descriptors.cpp
index afe1f54..b5913a3 100644
--- a/tests/aidl_test_client_file_descriptors.cpp
+++ b/tests/aidl_test_client_file_descriptors.cpp
@@ -50,7 +50,7 @@ namespace client {
#define FdByName(_fd) #_fd, _fd
-bool DoWrite(string name, const unique_fd& fd, const string& buf) {
+bool DoWrite(const string& name, const unique_fd& fd, const string& buf) {
int wrote;
while ((wrote = write(fd.get(), buf.data(), buf.size())) < 0 && errno == EINTR);
@@ -69,7 +69,7 @@ bool DoWrite(string name, const unique_fd& fd, const string& buf) {
return false;
}
-bool DoRead(string name, const unique_fd& fd, const string& expected) {
+bool DoRead(const string& name, const unique_fd& fd, const string& expected) {
size_t length = expected.size();
int got;
string buf;
diff --git a/tests/aidl_test_client_nullables.cpp b/tests/aidl_test_client_nullables.cpp
index e876af4..805827c 100644
--- a/tests/aidl_test_client_nullables.cpp
+++ b/tests/aidl_test_client_nullables.cpp
@@ -89,7 +89,7 @@ bool ValuesEqual<vector<unique_ptr<String16>>>(
}
template<typename T>
-bool ConfirmNullableType(const sp<ITestService>& s, string type_name,
+bool ConfirmNullableType(const sp<ITestService>& s, const string& type_name,
unique_ptr<T> in,
Status(ITestService::*func)(const unique_ptr<T>&,
unique_ptr<T>*)) {