summaryrefslogtreecommitdiff
path: root/tools/aapt2/util/Util.cpp
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2017-08-03 16:28:10 -0700
committerChih-Hung Hsieh <chh@google.com>2017-08-03 16:28:10 -0700
commit4dc5812dc065df9ce7427fdb270120cdf44025c3 (patch)
treea4e4c495dc800d3a6fab0fe86e558a86eada6a19 /tools/aapt2/util/Util.cpp
parentd02180fa204347407c45ff0dbb93a878a663fc08 (diff)
Fix clang-tidy performance warnings in aapt2.
* Use const reference parameter type to avoid unnecessary copy. * Use more efficient overloaded string methods. Bug: 30407689 Bug: 30411878 Test: build with WITH_TIDY=1 Change-Id: Iaa0a6f18f64cf573bee49dd1466281ea4d37b410
Diffstat (limited to 'tools/aapt2/util/Util.cpp')
-rw-r--r--tools/aapt2/util/Util.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/aapt2/util/Util.cpp b/tools/aapt2/util/Util.cpp
index 51a75d7556ad..a9b49d9d9904 100644
--- a/tools/aapt2/util/Util.cpp
+++ b/tools/aapt2/util/Util.cpp
@@ -520,11 +520,10 @@ bool Tokenizer::iterator::operator!=(const iterator& rhs) const {
return !(*this == rhs);
}
-Tokenizer::iterator::iterator(StringPiece s, char sep, StringPiece tok,
- bool end)
+Tokenizer::iterator::iterator(const StringPiece& s, char sep, const StringPiece& tok, bool end)
: str_(s), separator_(sep), token_(tok), end_(end) {}
-Tokenizer::Tokenizer(StringPiece str, char sep)
+Tokenizer::Tokenizer(const StringPiece& str, char sep)
: begin_(++iterator(str, sep, StringPiece(str.begin() - 1, 0), false)),
end_(str, sep, StringPiece(str.end(), 0), true) {}