From 8ae16db72a259c604eded3532b37f629724a13a9 Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Tue, 18 Dec 2018 11:10:31 -0800 Subject: [PATCH] vold: Pass std::string by const reference In a couple places, we change to pass a std::string argument instead of by copy. Test: TreeHugger Change-Id: Ib179299a2322fcbab4e6d192051218823ad66a36 --- KeyStorage.h | 2 +- MetadataCrypt.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/KeyStorage.h b/KeyStorage.h index 6aaf3ad..276b6b9 100644 --- a/KeyStorage.h +++ b/KeyStorage.h @@ -31,7 +31,7 @@ namespace vold { // If only "secret" is nonempty, it is used to decrypt in a non-Keymaster process. class KeyAuthentication { public: - KeyAuthentication(std::string t, std::string s) : token{t}, secret{s} {}; + KeyAuthentication(const std::string& t, const std::string& s) : token{t}, secret{s} {}; bool usesKeymaster() const { return !token.empty() || secret.empty(); }; diff --git a/MetadataCrypt.cpp b/MetadataCrypt.cpp index 8b4d04e..5c8a075 100644 --- a/MetadataCrypt.cpp +++ b/MetadataCrypt.cpp @@ -84,7 +84,7 @@ namespace vold { // Note: It is possible to orphan a key if it is removed before deleting // Update this once keymaster APIs change, and we have a proper commit. -static void commit_key(std::string dir) { +static void commit_key(const std::string& dir) { while (!android::base::WaitForProperty("vold.checkpoint_committed", "1")) { LOG(ERROR) << "Wait for boot timed out"; }