Use std::string_view throughout util strencodings/string

This commit is contained in:
Pieter Wuille
2022-04-04 15:05:47 -04:00
committed by MacroFake
parent 8ffbd1412d
commit e7d2fbda63
9 changed files with 69 additions and 56 deletions

View File

@@ -853,8 +853,8 @@ static bool GetConfigOptions(std::istream& stream, const std::string& filepath,
error = strprintf("parse error on line %i: %s, options in configuration file must be specified without leading -", linenr, str);
return false;
} else if ((pos = str.find('=')) != std::string::npos) {
std::string name = prefix + TrimString(str.substr(0, pos), pattern);
std::string value = TrimString(str.substr(pos + 1), pattern);
std::string name = prefix + TrimString(std::string_view{str}.substr(0, pos), pattern);
std::string_view value = TrimStringView(std::string_view{str}.substr(pos + 1), pattern);
if (used_hash && name.find("rpcpassword") != std::string::npos) {
error = strprintf("parse error on line %i, using # in rpcpassword can be ambiguous and should be avoided", linenr);
return false;