From 2b4eb676348f122ab0a21e19d7a3c57bd9898c6c Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Wed, 12 Jun 2024 09:30:37 +0000 Subject: Use C++20 `string{,_view}::{starts,ends}_with()`, part 2. Replace uses of `android::base::{Starts,Ends}With()`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I80a0ca93f433464270989d248dd999e9366a1c17 --- odrefresh/odrefresh_main.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'odrefresh/odrefresh_main.cc') diff --git a/odrefresh/odrefresh_main.cc b/odrefresh/odrefresh_main.cc index 144a9e97ae..2d3009e25c 100644 --- a/odrefresh/odrefresh_main.cc +++ b/odrefresh/odrefresh_main.cc @@ -41,7 +41,6 @@ namespace { using ::android::base::GetProperty; using ::android::base::ParseBool; using ::android::base::ParseBoolResult; -using ::android::base::StartsWith; using ::art::odrefresh::CompilationOptions; using ::art::odrefresh::ExitCode; using ::art::odrefresh::kCheckedSystemPropertyPrefixes; @@ -117,7 +116,7 @@ std::string GetEnvironmentVariableOrDefault(const char* name, std::string defaul } bool ArgumentMatches(std::string_view argument, std::string_view prefix, std::string* value) { - if (android::base::StartsWith(argument, prefix)) { + if (argument.starts_with(prefix)) { *value = std::string(argument.substr(prefix.size())); return true; } @@ -202,13 +201,13 @@ int InitializeConfig(int argc, char** argv, OdrConfig* config) { } void GetSystemProperties(std::unordered_map* system_properties) { - SystemPropertyForeach([&](const char* name, const char* value) { + SystemPropertyForeach([&](std::string_view name, const char* value) { if (strlen(value) == 0) { return; } for (const char* prefix : kCheckedSystemPropertyPrefixes) { - if (StartsWith(name, prefix)) { - (*system_properties)[name] = value; + if (name.starts_with(prefix)) { + (*system_properties)[std::string(name)] = value; } } }); -- cgit v1.2.3-59-g8ed1b