diff options
author | 2024-06-12 09:30:37 +0000 | |
---|---|---|
committer | 2024-06-14 10:14:50 +0000 | |
commit | 2b4eb676348f122ab0a21e19d7a3c57bd9898c6c (patch) | |
tree | 281ceaa54365c8c38ca94ea484c831aeb1951bf8 /odrefresh/odrefresh_main.cc | |
parent | 9132d9056cc1d4eb342d1a2b0315fc1f054ca2f8 (diff) |
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
Diffstat (limited to 'odrefresh/odrefresh_main.cc')
-rw-r--r-- | odrefresh/odrefresh_main.cc | 9 |
1 files changed, 4 insertions, 5 deletions
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<std::string, std::string>* 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; } } }); |